Linux 批量替换

代码格式:oldstring被替换的字符串

sed -i "s/oldstring/newstring/g" `grep  oldstring  -rl path`;

 

sed -i "s/192.168.0.2/192.168.0.3" `grep 192.168.0.2 -rl /home/project`;

 

将/home/project下面的所有含有192.168.0.2 的字符串替换成 192.168.0.3

相关推荐