bug-grep
[Top][All Lists]
Advanced

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

[bug-grep] Re: grep bug


From: Bob Proulx
Subject: [bug-grep] Re: grep bug
Date: Sat, 2 Apr 2005 11:28:50 -0700
User-agent: Mutt/1.5.8i

Moved this from bug-gnu-utils to bug-grep, the new location for grep
bug discussion.

Curt Lewis wrote:
> On Apr 1, 2005, at 9:48 AM, Bob Proulx wrote:
> >Curt Lewis wrote:
> >>fgrep -ri "cn: " *.ldif
> >>
> >>fgrep: *.ldif No such file or directory
> >
> >Thank you for your report.  But this is not a bug in grep.  You are
> >misunderstanding how the -r option to grep works.
> 
> From the man page:
> 
>        -r, --recursive
>               Read all files under each directory, recursively; this is 
> equiv-
>               alent to the -d recurse option.
> 
> 
> Your definition does not match the man page and my example should work 
> if the recursive function worked as advertised.

First the text says exactly "Read all files under each directory".
That applies to all directories listed on the command line.  In your
case you listed "*.ldif" and since that did not match any directories
the shell did not expand it and handed those literal characters to
grep.  Grep could not open that file.

Secondly the -r referred you to the -d recurse option.  That says:

       -d ACTION, --directories=ACTION
              If an input file is a directory, use ACTION to process  it.   By
              default,  ACTION  is read, which means that directories are read
              just as if they were ordinary files.  If ACTION is skip,  direc??
              tories  are  silently skipped.  If ACTION is recurse, grep reads
              all files under each directory, recursively; this is  equivalent

Clearly this says literally "If an input file is a directory".  Again
this only applies to input files that are directories.  Therefore the
recursive options only apply to directories listed in the grep
argument list.

The --help output and man page is by the very nature of the medium a
terse format.  There is really not enough room there to go off and
expand into a full user tutorial.  So some compromise must be made for
the same of usability.  Indeed if the output were too verbose others
would find it just as unusable!

> I do appreciate the workarounds, though.   :-)

Glad to help.

Bob

P.S. Please keep grep bug discussion on the mailing list and not to me
privately.




reply via email to

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