|
A little while ago I needed to search for all files in a CVS
repository that contains multiple character patterns (regular expressions).
In my case these patterns were "prevayl" and "jtable".
I couldn't find a way to do this with a simple combination of the
find and grep commands, but a friend with
some Unix foo suggested this command:
egrep -li "jtable" $(find . -name "*.java,v" -exec grep -li "prevayl" {} \;)
This command works by first finding all files whose name ends with
the characters "*.java,v" and also contains the string "prevayl". Once it
finds those files the find command prints the file names,
and then the egrep command kicks in to find the string "jtable".
There may be better ways of doing this, but for this purpose it was a
decent approach for finding multiple regular expressions in multiple files
spread out in multiple directories.
|