Issue
I would like to remove all lines containing a ' MCA: ' substring from /var/log/messages using a command line statement.
I tried sed but can not get it to work; sed -i '/ MCA: /' /var/log/messages #results in; #sed: 1 "/ MCA: /": command expected
does anyone know how to do this? does not have to be sed
Solution
You are looking to delete entries and so need to add /d.
sed '/MCA\:/d' /var/log/messages
This will output the modified file to screen
Once you are happy, run:
sed -i '/MCA\:/d' /var/log/messages
To commit the changes to the file.
Answered By - Raman Sailopal Answer Checked By - David Goodson (WPSolving Volunteer)