1、将当前目录下包含jack串的文件中,jack字符串替换为tom
sed -i "s/jack/tom/g" `grep "jack" -rl ./`
2、将某个文件中的jack字符串替换为tom
sed -i "s/jack/tom/g" test.txt
3、不检索某个文件
sed -i "s/jack/tom/g" `grep "jack" -rl --exclude="replacenameofpackage" ./`
1、将当前目录下包含jack串的文件中,jack字符串替换为tom
sed -i "s/jack/tom/g" `grep "jack" -rl ./`
2、将某个文件中的jack字符串替换为tom
sed -i "s/jack/tom/g" test.txt
3、不检索某个文件
sed -i "s/jack/tom/g" `grep "jack" -rl --exclude="replacenameofpackage" ./`