Answers:
也许您可以使用sed
示例1 – sed
@
分隔符:替换/opt/omni/lbin
为/opt/tools/bin
当您替换具有的路径名时
/
,可以将其@
用作定界符而不是/
。在下面的sed示例中,输入文件的最后一行/opt/omni/lbin
更改为/opt/tools/bin
。$ sed 's@/opt/omni/lbin@/opt/tools/bin@g' path.txt /usr/kbos/bin:/usr/local/bin:/usr/jbin/:/usr/bin:/usr/sas/bin /usr/local/sbin:/sbin:/bin/:/usr/sbin:/usr/bin:/opt/omni/bin: /opt/tools/bin:/opt/omni/sbin:/root/bin
来自:http : //www.thegeekstuff.com/2009/10/unix-sed-tutorial-advanced-sed-substitution-examples/