Delete all lines that contain a specific string from a text file

Deletes all lines from a text file that contain a specific string. Pass the `-i` flag to modify the file in place.

Authored by: SiegeX
string
file

Command
Copy
sed -i '' '/string/d' file
Tags