查找并替换目录中及其下方的所有文件
以下shell命令使用find函数在当前目录中或目录下查找扩展名为php的所有文件。然后,它将找到的每个文件传递到sed命令,然后将其替换为较长的文件
version. [geshifilter-code]find . -name '*.php' -exec sed -ie 's#<?#<?php#' {} \;[/geshifilter-code]The -name argument in find will look at the base of the file name, that is, the file without any directory path. The -exec command is used to pass each file found onto another command, in this case sed is used.