0

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 /?

Tom Hale
  • 40,825
  • 36
  • 187
  • 242

1 Answers1

0

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
Tom Hale
  • 40,825
  • 36
  • 187
  • 242