Linux 从查找和重命名中排除目录
我正在使用此命令浏览所有文件、目录和子目录,以将提及的Linux 从查找和重命名中排除目录,linux,bash,replace,sed,find,Linux,Bash,Replace,Sed,Find,我正在使用此命令浏览所有文件、目录和子目录,以将提及的oldurl.com更改为newurl.org: find . -type f -name '*.php' -exec sed -i 's|oldurl.com|newurl.org|g' {} + 它工作正常,但是,我需要从任何更改中排除三个子目录:/cache、/archive和/etc,因为在这些路径中使用上述命令更改URL会中断其他脚本 还没找到答案。。。有可能吗 非常感谢您的建议/帮助。使用查找-不选项: find . -type
oldurl.com
更改为newurl.org
:
find . -type f -name '*.php' -exec sed -i 's|oldurl.com|newurl.org|g' {} +
它工作正常,但是,我需要从任何更改中排除三个子目录:/cache
、/archive
和/etc
,因为在这些路径中使用上述命令更改URL会中断其他脚本
还没找到答案。。。有可能吗
非常感谢您的建议/帮助。使用查找
-不选项:
find . -type f -name '*.php' -not \( -path './etc/*' -o -path './cache/*' -o -path './archive/*' \) -exec sed -i 's|oldurl.com|newurl.org|g' {} \;
可能重复的