[root@test baojing]# cat piliang.sh
#!/bin/bash
find /root/baojing/ -name "*.sh" | while read f
do
sed -i 's/www.sina.com/www.china.com/g' $f
done
说明:/root/baojing/ 目录下所有.sh 结尾的文件里包含www.sina.com 都替换成www.china.com
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/456623