I have a file f1:
line1
line2
line3
line4
..
..
I want to delete all the lines which are in another file f2:
grep -v -x -f f2 f1 should do the trick.
Explanation:
-v to select non-matching lines-x to match whole lines only-f f2 to get patterns from f2One can instead use grep -F or fgrep to match fixed strings from f2 rather than patterns (in case you want remove the lines in a "what you see if what you get" manner rather than treating the lines in f2 as regex patterns).