sed

来源:互联网 发布:博客程序ag源码一条龙 编辑:程序博客网 时间:2024/04/25 14:09

插入:

sed -i '/dbu reg ini ip/ i\

xxx

xxx

xxx\

' file

 

前面加#注释几行:

sed -e '433,436s/\(^[^#].*\)/#\1/g' ${FILENAME}

可以加-i直接修改文件。

 

删除几行

num=`sed -n "/Application (/=" $FILE`

endno=`expr $num+4`

sed -i "$num,${endno}d" $FILE

=表示打印行号 -e cmd -i修改文件 -n silent

 

sed ‘s/\\/\//g’

find `echo $PATH|sed 's/:/ /g'` | more