Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 以给定名称替换单词递归搜索所有文件_Linux_Bash_Sed_Grep_Find - Fatal编程技术网

Linux 以给定名称替换单词递归搜索所有文件

Linux 以给定名称替换单词递归搜索所有文件,linux,bash,sed,grep,find,Linux,Bash,Sed,Grep,Find,从给定文件夹中,我希望递归搜索所有子文件夹,搜索名为file.txt的文件,替换所有出现的Foo-区分大小写- 使用条 这是使用基本脚本(Bash/sed/grep/find…)实现这一点的最简单方法。

从给定文件夹中,我希望递归搜索所有子文件夹,搜索名为
file.txt
的文件,替换所有出现的
Foo
-区分大小写- 使用


这是使用基本脚本(Bash/sed/grep/find…)实现这一点的最简单方法。

+
sed
解决方案:

find . -type f -name "file.txt" -exec sed -i 's/Foo/Bar/g' {} \;