bash - Confusion Regarding ! Character in Sed -


these 2 sed commands appear behave identically:

$ sed "s/^replace=*/replace=mytest/g" test.txt   $ sed "   s!^replace=*!replace=mytest!g " test.txt 

why this? can ! character used instead of /? not see explanation of ! character in sed documentation.

you should read man-pages more closely :)

info sed:

3.5 s command

the syntax of s (as in substitute) command ‘s/regexp/replacement/flags’. / characters may uniformly replaced other single character within given s command. / character (or whatever other character used in stead) can appear in regexp or replacement if preceded \ character.

tl;dr

as mentioned in these man-pages, can use single character separator sed regexp , replacement.

edit: evil otto crystal clearing :)


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -