go ahead... be a heretic | |
PerlMonks |
Re: a one-liner for this trivial problem?by PrakashK (Pilgrim) |
on Apr 19, 2013 at 19:11 UTC ( [id://1029566]=note: print w/replies, xml ) | Need Help?? |
perl -ne 'BEGIN {open my $sh, "<", shift; %h = map {$_ => 1} <$sh>} print unless $h{$_}' small large Read the small file in the BEGIN block and shift it out of @ARGV. A minor plus of this approach is that any number of "large" files can be passed, after the "small" file. If you have File::Slurp available: perl -MFile::Slurp=slurp -ne 'BEGIN {%h = map {$_ => 1} slurp shift} print unless $h{$_}' small large
In Section
Seekers of Perl Wisdom
|
|