sed替换写法sed -e 's; ;:;g'

sed替换的两种写法,今天看脚本的时候遇到了一个没见过的写法:

用;替代/的

如下:

root@iZ2zegl8h62gwjeuf4d47lZ:~# echo "hello;nihao" | sed -e 's;;;:;g'     #####   ;代替了 /  等同于下面的写法

hello:nihao

root@iZ2zegl8h62gwjeuf4d47lZ:~# echo "hello;nihao" | sed -e 's/;/:/g'

hello:nihao

原文地址:https://www.cnblogs.com/if-then/p/7202624.html