[PLUG] Recursive grep

Mike Witt mike at computer-arts.net
Mon Sep 23 19:11:06 UTC 2002


When I want to grep through (for example) all the .c files in
a hierarchy I've been using find, for example:

  find . -name \*.c -exec fgrep -H "find.this.string" {} \;

It SEEMS like I ought to be able to accomplish the same thing using
grep recursively, something like: 

  grep -r "find.this.string" *.c

but I can't figure out any way to cause the "*.c" to be evaluated
at the right time in order to actually run the grep on all the C
files in the hierarchy.

Am I missing something, or is recursive grep only good for searching
through ALL files in a hierarchy?

-Mike



More information about the PLUG mailing list