I know in some circumstances, other characters besides /
can be used in a sed
expression:
sed -e 's.//..g' file
replaces //
with the empty string in file
since we're using .
as the separator.
But what if you want to delete lines matching //comment
in file
?
sed -e './/comment.d' file
returns
sed: -e expression #1, char 1: unknown command: `.'
You can use still use alternate delimiter:
sed '\~//~d' file
Just escape the start of delimeter once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With