Centos 批量替换文件内容命令

把/usr/local/apache/conf下的所有conf的文件内容里含有【/usr/local/apache/htdocs】,改为【/data/wwwroot】。具体操作如下:

#sed -i “s/\/usr\/local\/apache\/htdocs/\/data\/wwwroot/g” `find . -name “*.conf” | xargs grep “/usr/local/apache/htdocs” -rl`

#或

#find . -type f -exec sed -i ‘s#/usr/local/apache/htdocs#/data/wwwroot#g’ {} \;

转载自
http://www.centoscn.com/CentosServer/www/2013/0728/705.html

标签: none

添加新评论