To remove all the lines in a file which has a certain search string can be accomplished easily using sed.
For example, to remove all the lines in
in.txt with the text
$ sed '/foobar/d' in.txt > out.txt
If you would like the line removal to be performed in-place on the input file:
$ sed -i '/foobar/d' in.txt
Tried with: Sed 4.2.2 and Ubuntu 14.04