Paul Tomblin Already gave a terrific answer, but I thought I saw a pattern in what you did.
Most likely, you will use find to create a list of files to be processed with grep one day, and for such a task there is a much more convenient tool, Ack
It works on any system that supports perl, and searching all C ++ related files in a directory recursive for a given string is as simple as
ack "int\s+foo" --cpp
"--cpp" defaults to .cpp .cc .cxx .m .hpp .hh .h .hxx files
(It also skips repository repositories by default, so it is not consistent with files that look like files in them.)
Kent Fredric Nov 10 '08 at 15:39 2008-11-10 15:39
source share