您的位置:首页 > 运维架构 > Shell

shell 遍历目录下后缀名为.html的文件,并替换文件中内容

2017-06-02 13:15 435 查看
1、shell查找 .html文件,例:

find /usr/local/guotom/webapps/ZingMH/nodeJs/tpls/views/ -type f -name '*.html'

2、替换方法

sed -i "s/邀请/呵呵/g"【将邀请替换为呵呵】

3、查找并替换

find /usr/local/guotom/webapps/ZingMH/nodeJs/tpls/views/ -type f -name '*.html'|xargs sed -i "s/邀请/呵呵/g"【查找/usr/local/guotom/webapps/ZingMH/nodeJs/tpls/views/目录下所有html文件中的内容并将文件中邀请替换为呵呵】
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  shell 遍历 替换 修改
相关文章推荐