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
Brought to you by Warp, a free terminal reimagined to work like a modern app.
string
file

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