📅 2014-Aug-11 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ delete, sed ⬩ 📚 Archive
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 foobar
:
$ 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