What does the # character mean in this line:
/bin/sed -e 's#abc#zzz#g' 2 Answers
It's a delimiter or separator. The most commonly used one is / as in
sed 's/old/new/' fileBut sed will take the first character after the command (s) as delimiter. You can use any convenient character, for example...
sed 's%old%new%' fileThis is very useful if the file contains / (or other conventional delimiting characters). You can choose as separator some character that you know you won't need to put into your sed expression, saving you a lot of annoying escaping.
Let's say you want to replace
with
You could use
sed 's/https:\/\/askubuntu.com\/questions/https:\/\/askubuntu.com\/posts/' fileBut better to use
sed 's| file 8 It's a separator, just like "/", it's same as 's/abc/zzz/g'.
it means search for "abc" replace it with "zzz", with global flag, means do it for all "abc"s on the line, not just the first one.
You can also use an alternative separator for a pattern address, but in that case, you need to escape it for it to be correctly interpreted:
sed -r '\#abc#p'