Sed NotesPublished on 29 July, 2020 by Amanda
Replace text in file
sed -i '/pattern to match/new string' ./infileDelete lines in a file(s)
In this example lines containing -- are deleted.
sed -i '/--.*/d' ./*
sed -i -e '/^\s*#\([^!]\|$\)/d'
Where: ^ = start of line \s* = zero or more whitespace characters # = one hash mark \([^!]\|$\) = followed by a character which is not ! or end of line.Reference:https://unix.stackexchange.com/a/374128