in reply to Re: a one-liner for this trivial problem?
in thread a one-liner for this trivial problem?

Yeah, true, I was just hoping there could be an one-liner solution to this, and not need to write a "normal" script...
  • Comment on Re^2: a one-liner for this trivial problem?

Replies are listed 'Best First'.
Re^3: a one-liner for this trivial problem?
by Corion (Patriarch) on Apr 16, 2013 at 14:50 UTC

    You can do that in one line. The easiest way is to use a really long line and to fill that line by removing all line breaks from the script.

    Maybe you can show us the code you've already written to solve the problem. Then we can help you with the technical hurdles that might prevent that code from working as a one-liner.

      Something like this...
      ($small_file, $big_file) = @ARGV; open SMALL, $small_file; while(<SMALL>) { $id_to_remove=$_; chomp $id_to_remove; $hash_to_remove{$id_to_remove} = $id_to_remove; } close SMALL; open BIG, $big_file; while(<BIG>) { $id_to_check=$_; chomp $id_to_check; if(not exists $hash_to_remove{$id_to_check}) {print $id_to_check."\n";} } close BIG;