文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>linux批量修改文件内容

linux批量修改文件内容

时间:2009-07-14  来源:流星陨落

脚本目的:把一个目录下所有php文件中的 Louis/Site.css 改成 louis/site.css

1.       进入php文件目录

cd /home/sofialeather.com/public_html/

2.       查找出包含Louis/Site.css 的所有文件名(该步骤不用操作,脚本中有的)

[root@webhosting3 public_html]# find -name "*.dwt" -exec  awk '/Louis\/Site.css/{print FILENAME}' {} \;

./ec/themes/default-ppg1/library/index.dwt

./ec/themes/default-ppg1/index.dwt

./ec/themes/default-ppg1/article.dwt

./ec/themes/default-ppg1/category.dwt

./ec/themes/default-ppg1/user_passport.dwt

./ec/themes/default-ppg1/search.dwt

./ec/themes/default-ppg1/goods.dwt

./ec/themes/cyfanke/library/goods.dwt

./ec/themes/cyfanke/goods.dwt

./js/goods.dwt

./themes/default-ppg2/user_clips.dwt

./themes/default-ppg2/article6.dwt

./themes/default-ppg2/user_transaction.dwt

./themes/default-ppg2/library/user_clips.dwt

./themes/default-ppg2/library/user_transaction.dwt

./themes/default-ppg2/library/index.dwt

./themes/default-ppg2/library/user_passport.dwt

./themes/default-ppg2/library/goods.dwt

./themes/default-ppg2/article3.dwt

./themes/default-ppg2/index.dwt

./themes/default-ppg2/article5.dwt

./themes/default-ppg2/flow.dwt

./themes/default-ppg2/article1.dwt

./themes/default-ppg2/article4.dwt

./themes/default-ppg2/article.dwt

./themes/default-ppg2/message.dwt

./themes/default-ppg2/article2.dwt

./themes/default-ppg2/category.dwt

./themes/default-ppg2/user_passport.dwt

./themes/default-ppg2/search.dwt

./themes/default-ppg2/goods.dwt

find -name "*.php" -exec grep -n -H Louis/Site.css {} \;

find -name "*.dwt" -exec grep -n -H Louis/Site.css {} \;

3.       执行替换脚本

./replace.sh  "Louis\/Site.css"  "Louis\/test.css"

查找符合条件的文件名:find -name "*.dwt" -exec  awk '/Louis\/Site.css/{print FILENAME}' {} \;

相关阅读 更多 +
排行榜 更多 +
盒子小镇2游戏手机版下载

盒子小镇2游戏手机版下载

冒险解谜 下载
世界盒子模组版下载最新版本

世界盒子模组版下载最新版本

模拟经营 下载
音乐搜索app最新版本下载

音乐搜索app最新版本下载

趣味娱乐 下载