How can I change the 'sed' slash (/) delimiter in insert command? -


changing delimiter slash (/) pipe (|) in substitute command of sed works below

echo hello | sed 's|hello|world|' 

how can change delimiter slash (/) pipe (|) in sed insert command below?

echo hello | sed '/hello/i world' 

i'm not sure intended command mentioned:

echo hello | sed '/hello/i world' 

however, presume want perform action on lines matching pattern hello. lets wanted change lines matching pattern hello world. in order accomplish that, can say:

$ echo -e "something\nhello" | sed '\|hello|{s|.*|world|}' world 

in order match lines using regexp, following forms can used:

/regexp/ \%regexp% 

where % may replaced other single character (note preceding \ in second case).

the manual provides more details on this.


Comments