linux替换文件内容

Posted 小立攻城狮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux替换文件内容相关的知识,希望对你有一定的参考价值。

使用sed命令

1、替换test.txt文件中的hello为hello world

set -i 's/hello/hello world/g' test.txt

2、替换当前目录下的所有文件中的hello为hello world

set -i 's/hello/hello world/g' ls

以上是关于linux替换文件内容的主要内容,如果未能解决你的问题,请参考以下文章