sed用法

sed -i '2a his is a test line' test.conf

就是在test.conf中的第二行下边加上一行"this is a test line"

把一个文件的内容插入另一个文件:

sed -i '2 r file1' file2

2代表插到第二行下边

替换文件中的 properties 为 property,

如果想直接修改源文件,可以用下面的命令

sed  -i 's/properties/property/g'  build.xml

这样,就直接修改了build.xml文件。


转自: http://man.linuxde.net/sed

http://www.blogjava.net/zhyiwww/archive/2008/11/24/242281.html

原文地址:https://www.cnblogs.com/pinganzi/p/5284352.html