I want to use sed
on some text that contains backslashes, and want to avoid lots of escaped \/
characters.
How can I change the delimiter or separator character to be other than /
?
In GNU sed
, simply swap out the /
for the character you wish to use:
% echo /// | sed 's_/_x_g'
xxx
\
can also be used, and must not be escaped (it fails when escaped as \\
):
% echo xxx | sed 's\x\y\g'
yyy