Ubuntu – How to find lines matching a pattern and delete them

command linetext processing

In a file with lots of lines I want to delete lines that starts with HERE IT IS.

How can I do this using only command-line tools?

Best Answer

Try sed:

sed -i '/^HERE IT IS/d' <file>

WARNING: Its better to take a backup when using -i switch of sed:

sed -i.bak '/^HERE IT IS/d' <file>

The original file will remain as <file>.bak and the modified file will be <file>.

Related Question