A Clockwork Orange A Clockwork Orange - 6 months ago 10x
Bash Question

Delete lines in a text file that containing a specific string

How would I use to delete the whole line in a text file that contains a specific string?


To remove the line and print the output to standard out:

sed '/pattern to match/d' ./infile

To directly modify the file (and create a backup):

sed -i.bak '/pattern to match/d' ./infile