in reply to perl6 phasers and a 1 liner
Thank You Monks,
I setteled on:
perl6 -ne 'my $ids; BEGIN {$ids="patternFile.txt".IO.lines.Set}; my @F=$_.split("\t"); if @F[0] (elem) $ids {@F.join("\t").say}' searchFile.txtMuch as Anonymous Monk suggested but with Laurent_R's use of declaring $ids outside of the BEGIN block / before the BEGIN phaser. I think that Anonymous Monk's original suggestion would have re-read the patternFile on every line which would be inefficient.
In retrospect I clearly had an equivocation in my mental model of what lines does a I used it to pull in all the lines for the first file and then tried to used it a bit like <> from perl5 to read in 1 line at a time from STDIN.
Thanks again!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl6 phasers and a 1 liner
by Laurent_R (Canon) on Feb 15, 2018 at 19:07 UTC |