in reply to Re^2: Filtering lines from one file from another
in thread Filtering lines from one file from another

I have tried with grep -xvf file2 file1 and seems to work
  • Comment on Re^3: Filtering lines from one file from another

Replies are listed 'Best First'.
Re^4: Filtering lines from one file from another
by bellaire (Hermit) on Feb 03, 2011 at 19:05 UTC
    True, or even further, grep -xvFf, to not only match the entire line, but to treat the "patterns" from file2 as fixed strings rather than regexes. L~R has a good point about large file size limitations, though. I can't really speak to that point.
Re^4: Filtering lines from one file from another
by Limbic~Region (Chancellor) on Feb 03, 2011 at 23:48 UTC
    antonn,
    The reason it seems to work is due to your specific data set. The solution without modification is fragile. This is because grep assumes that the file contains regular expressions (called patterns) not fixed strings. It would be better to add the -F option as shown by bellaire to treat them as fixed strings.

    Cheers - L~R