赞
踩
[ck143117137@shell.ceshiren.com ~]$ sed '2i newline' test02.txt
## 在第二行上面插入newline,此操作只在虚拟空间内运行
heleo
newline
hi
deomo
deiji
halao
yaoyingodng
12312412
312312jdasd
12312321
21321321313
yaoyingdong@192 ~ % sed 's/abc/abcd/' test02.txt
hi
yaoyingdong
abcd
123123
hello
name
id
dsiadjia
ahahah
qweqe
nnnnaana
分隔线 分隔线分隔线分隔线分隔线分隔线分隔线分隔线分隔线分隔线分隔线分隔线分隔线分隔线
直接修改文件内容-i参数谨慎使用
[ck143117137@shell.ceshiren.com ~]$ sed -i 's/hi/him/' test02.txt
[ck143117137@shell.ceshiren.com ~]$ cat test02.txt
heleo
him
newdemo
deomo
deiji
halao
yaoyingodng
12312412
312312jdasd
12312321
21321321313
[ck143117137@shell.ceshiren.com ~]$
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。