现将文件a.txt 中的所有abc 替换成def

使用sed命令:

[root@xusx xusx]# cat a.txt

a123b123c

ab12abc

[root@xusx xusx]# sed 'y#abc#def#' a.txt

d123e123f

de12def

使用tr命令:

[root@xusx xusx]# cat a.txt 

a123b123c
ab12abc

[root@xusx xusx]# tr 'abc' 'def' <a.txt 
d123e123f
de12def

posted @ 2016-11-15 10:38  reborn枪  阅读(629)  评论(0编辑  收藏  举报