-
RHCE认证用户应掌握的一个sed实例
资源介绍
一个sed例子
把文件aboutsed.txt中所有的单词"slow"换成"fast"
$ sed s/slow/fast/g aboutsed.txt > output.txt
[kevinz @stationxx kevinz ] $cat aboutsed.txt
sed is a wonderful streaming editor.Its small size make it very slow.
In fact,many people choose to use sed because it is so slow.
[kevinz @stationxx kevinz ] $ sed s/slow/fast/g aboutsed.txt > output.txt
[kevinz @stationxx kevinz ] $ cat output.txt
sed is a wonderful streaming editor.Its small size make it very fast.
In fact,many people choose to use sed because it is so fast.
在上面的例子中,s/命令告诉 sed在文件aboutsed.txt中搜索单词slow然后替换单词fast。命令后面的g告诉sed去替换文件中的所有匹配。
- 上一篇: POP和IMAP-RHCE认证用户基础
- 下一篇: sed脚本-RHCE认证用户基础