Another option with grep (works on strings)
grep -v PATTERN filename > newfilename
For instance:
filename has the following lines:
this is not implicated but important text this is not important text this is important text he says not important text he says not this it is more important text
Filter:
grep -v "not imp" filename > newfilename
will create newfilename with the following three lines:
this is not implicated but important text this is important text he says not this it is more important text
You will need to select PATTERN, which uniquely identifies the lines you are trying to delete. If you use PATTERN from "important text" , it will match all lines, and "not imp" matches only lines that contain the words "not imp" . Use egrep (or grep -E ) for regexp filters if you want more flexibility when matching with a pattern.
source share