$ cat C grape apricot cherry $ perl -e 'open F,$ARGV[0] or die;shift;my %set = map {$_ => 1 } <>; for () {print unless $set{$_}};' A B C apple carrot $ perl -e 'open F,$ARGV[0] or die;shift;my %set = map {$_ => 1 } <>; for () {print if $set{$_}};' A B C cherry lime