shell替换代码

#!/bin/bash
find /home1/www/webpub/hd -name"*.shtml"|xargs sed -i "s/\/ad_/\//g"
find /home1/www/webpub/hd -name "*.inc"|xargs sed -i "s/\/ad_/\//g"
find /home1/www/webpub/hd -name "*.php"|xargs sed -i "s/\/ad_/\//g"
find /home1/www/webpub/hd -name "*.html"|xargs sed -i "s/\/ad_/\//g"
find /home1/www/webpub/hd -name "*.htm"|xargs sed -i "s/\/ad_/\//g"
find /home1/www/webpub/hd -name "*.js"|xargs sed -i "s/\/ad_/\//g"


#!/bin/bash
ROOT_DIR='/home1/www/webpub/hd'
for i in .js .php .inc .html .shtml
do
for j in `find $ROOT_DIR -name "*$i"`
do
sed -i -e 's!/advertisement/!/upload/!' -e 's!/ad_!/!g' $j
done
done

 



本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/456620

上一篇:Windows下安装pip、模块及更改pip源


下一篇:下载Google官方/CM Android源代码自动重新开始的Shell脚本