I try to replace / with # separators in sed print command but don't succeed. Please look at the third line beneath:
u@debian:~$ echo A | sed -n '/A/p'
A
u@debian:~$ echo A | sed -n '#A#p'
u@debian:~$ echo A | sed -n s#A#B#p
B
u@debian:~$
How to replace it?
Preamble
Reading the title of your question, I think you have to read quietly the
address chapter*ininfo sed!Understanding the difference between addressing and commands!
s, likepare commands!So your request is about addressing for executing a command.
Address range and address for commands
Little sample: comment all lines that contain badWord:
More complete sample:
4.3(chapter4.3 selecting lines by text matching) to the next line that begin by5(chapter5 Regular Expressions: selecting text) ,'(or a UTF8 open quote:‘),afor further branch (goto),a.This will extract, from
info sed, the following:In fine, regarding your question:
So you have to precede your 1st delimiter by a backslash
\: