in reply to a one-liner for this trivial problem?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a one-liner for this trivial problem?
by tbone654 (Beadle) on Aug 27, 2013 at 14:38 UTC |