The following works with GNU sed versions 4.5 and 4.7 and will delete any lines that contain the string:
sed '/\/abc\/gef \\\*(cse,fff)/d' file
You have to use \
to escape the two instances of /
in the string so that they aren't taken as the delimiter and *
which otherwise expands to the character before it which is f
. The latter will cause it not to match the string.
You can also use the s
option which allows other characters as a delimiter if you only want to delete the string itself throughout the file and not the entire line:
sed 's|/abc/gef \\\*(cse,fff)||g' file
That uses |
as a delimiter so that you don't have to escape /
.
To edit the file in place after you're sure that it does what you want, you can use -i
like you have above:
sed -i '/\/abc\/gef \\\*(cse,fff)/d' file sed -i 's|/abc/gef \\\*(cse,fff)||g' file
EDIT: I have updated the answer as the string in the question is different from what it was when originally posted.