linux 删除文件一行操作

root@localhost ~]# cat file
hello world
a:b:c -h -n
a:b:c -h -n
[root@localhost ~]# sed -i '/a:b:c -h -n/d' file
[root@localhost ~]# cat file
hello world
[root@localhost ~]# sed -i 's/hello/baidu/' file.sh
[root@localhost ~]# cat file.sh
baidu world

猜你喜欢

转载自cooler1217.iteye.com/blog/1407799