Sed替换文本中的指定内容
时间:2014-07-16 16:48:45
收藏:0
阅读:501
可以这样做:
方法1:
sed -i ‘s/被替换的内容/要替换成的内容/‘ file
方法2:
sed ‘s/被替换的内容/要替换成的内容/g‘ file > file.out
mv file.out file
这里注意:
不能这样做:
sed ‘s/被替换的内容/要替换成的内容/g‘ file > file
这样只会清空源文件。
原文:http://www.cnblogs.com/oskb/p/3848581.html
评论(0)