bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep -r problem


From: Karl Berry
Subject: Re: grep -r problem
Date: Sat, 10 May 2003 13:07:53 -0400

      grep with -r wants directories

Well ... I hate to beat a dead horse, and I know you know this, but
... technically, grep -r searches files too.  I mean, it doesn't ignore
files :).  It just recurses into subdirs when it comes across them,
instead of skipping them (as it does without -r).

The traditional solution you mentioned:

    find . -name '*.c' -print0 | xargs -r0 grep void

is good, of course.  In this particular case,

  find -name *.c | xargs grep void

will work just as well, I think.  Unless you happen to have newlines in
your .c filenames.

      grep -r void .

    That greps every file and not just *.c files as your originally
    asked.  But machines are so fast these days that many consider that
    fine.
    
Amen.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]