How would I use sed to delete all lines in a text file that contain a specific string?
Shell – How to Delete Lines Containing a Specific String from a Text File
in-placesedshelltext-parsing
in-placesedshelltext-parsing
How would I use sed to delete all lines in a text file that contain a specific string?
Best Answer
To remove the line and print the output to standard out:
To directly modify the file – does not work with BSD sed:
Same, but for BSD sed (Mac OS X and FreeBSD) – does not work with GNU sed:
To directly modify the file (and create a backup) – works with BSD and GNU sed: