find . -type f -exec egrep -Hn 'function\(.*(\$string|\$_string).*\)' '{}' ';'
能够处理包含空格的文件名,并且如果有很多文件。你知道吗
man 3 regex如果您想了解有关regex语法的更多信息:
. any character, in shell (sh/csh) this is '?'
.* zero or more any characters
a* zero or more a's
(alpha|beta) groups, either alpha or beta
^ beginning of string
$ end of string, that's why it needs to be escaped
我建议您
ack
,它是为此目的而设计的(它将文件过滤为不在.svn
、.git
等目录中搜索)。你知道吗见http://betterthangrep.com/
所以:
试试看
能够处理包含空格的文件名,并且如果有很多文件。你知道吗
man 3 regex
如果您想了解有关regex语法的更多信息:相关问题 更多 >
编程相关推荐