Chinaunix首页 | 论坛 | 博客
  • 博客访问: 261684
  • 博文数量: 93
  • 博客积分: 3001
  • 博客等级: 中校
  • 技术积分: 1050
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-11 13:20
文章分类

全部博文(93)

文章存档

2011年(1)

2009年(92)

我的朋友

分类: LINUX

2009-07-14 15:27:02

脚本目的:把一个目录下所有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}' {} \;

阅读(2008) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~