How would I use sed to delete all lines in a text file that contain a specific string?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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: