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

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

Re: grep : -r (recursive) option does not work when... ( grep (GNU gre


From: Alain Magloire
Subject: Re: grep : -r (recursive) option does not work when... ( grep (GNU grep) 2.4 )
Date: Mon, 3 Sep 2001 20:32:11 -0400 (EDT)

Bonjour

> Hello:
> grep : -r (recursive) option does not work in the follwing context:
> 
> grep -ri   string *.c
> 
> The command is ran from a top directory but in this case the c files are at a 
> lower level.
> 
> Grep exits without "going" to look for c files (in this example) in the lower 
> level directories.   Error message: "No such file or directory".
> 
> I do believe that the -r option should either disable the error checking for 
> this, or (better) only issue it if no qualified file is found in the 
> directory tree.
> 
> Thanks for your attention.

Please read the doc info on how to use this option.

 From the cvs repository, grep documentation FAQ:
===============================================
  2. How do I search directories recursively?

          grep -r 'hello' /home/gigi

     searches for `hello' in all files under the directory
     `/home/gigi'.  For more control of which files are searched, use
     `find', `grep' and `xargs'.  For example, the following command
     searches only C files:

          find /home/gigi -name '*.c' -print | xargs grep 'hello' /dev/null

     This differs from the command:

          grep -r 'hello' *.c

     which merely looks for `hello' in all files in the current
     directory whose names end in `.c'.  Here the `-r' is probably
     unnecessary, as recursion occurs only in the unlikely event that
     one of `.c' files is a directory.
===============================================
If it is unclear I'll be happy for a patch to clear this up.

--
alain




reply via email to

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