BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] Please help with a BASH puzzle
- Subject: [Discuss] Please help with a BASH puzzle
- From: bill.n1vux at gmail.com (Bill Ricker)
- Date: Fri, 23 Aug 2019 23:56:41 -0400
- In-reply-to: <CANvYDT+_FKZ8yCz=RmmcrKp6C++9r71DkBWG0tbqU2z+nSDq5Q@mail.gmail.com>
- References: <cccf29d6-362e-020f-f28b-d0e950ee002f@horne.net> <cada1d7f-db66-b8dd-5b07-587ecf1ff685@thekramers.net> <26819662-4b1c-50f5-095e-14404d13664b@horne.net> <bdf8cfce-0c5a-a459-5aff-069f046e8157@thekramers.net> <7b2aadab-1820-9247-76e9-b3cd6de02edf@thekramers.net> <CANvYDT+_FKZ8yCz=RmmcrKp6C++9r71DkBWG0tbqU2z+nSDq5Q@mail.gmail.com>
On Fri, Aug 23, 2019 at 11:05 PM Chris Tyler <chris at tylers.info> wrote: > This will generate a "complete" file (36^4 = 1.6 million lines, 8.1 MB) in > bash: > > a="{$(echo {0..9} {A..Z}|tr " " ,)}"; eval echo $a$a$a$a | tr " " "\012" > >/tmp/all > > ...Which you can then compare your input file against using the comm > command. (It runs in <5s on my chromebook here). ... and if you don't want to save it to disk, you can wrap it to stream both inputs on pipe-like file-descriptors as previously described - (export LC_ALL=C; comm -23 <( a="{$(echo {0..9} {A..Z}|tr " " ,)}"; eval echo $a$a$a$a | tr " " "\012") $inputfile) (8MB isn't a large file these days ... but if the real data is wider ... and thus both files exponentially larger ... might want a more streaming generator )
- References:
- [Discuss] Please help with a BASH puzzle
- From: bill at horne.net (Bill Horne)
- [Discuss] Please help with a BASH puzzle
- From: david at thekramers.net (David Kramer)
- [Discuss] Please help with a BASH puzzle
- From: bill at horne.net (Bill Horne)
- [Discuss] Please help with a BASH puzzle
- From: david at thekramers.net (David Kramer)
- [Discuss] Please help with a BASH puzzle
- From: david at thekramers.net (David Kramer)
- [Discuss] Please help with a BASH puzzle
- From: chris at tylers.info (Chris Tyler)
- [Discuss] Please help with a BASH puzzle
- Prev by Date: [Discuss] Please help with a BASH puzzle
- Next by Date: [Discuss] Please help with a BASH puzzle
- Previous by thread: [Discuss] Please help with a BASH puzzle
- Next by thread: [Discuss] Please help with a BASH puzzle
- Index(es):