grep annoyance!
Craig White
plug-devel@lists.PLUG.phoenix.az.us
Fri Apr 15 11:19:02 2005
On Fri, 2005-04-15 at 11:09 -0700, Alan Dayley wrote:
> GNU grep has annoyed me for a very long time for this one "fault" and it
> happened again just now. I had to whine about it.
>
> - Suppose I have a directory structure like so:
> project1---ui------frame.c
> | |-enter.c
> | \-ui.h
> |-logic---main.c
> | |-transaction.c
> | \-main.h
> |-README
> \-COPYING
>
> - Suppose I want to do a grep seach of all the .c files for "string"
>
> I go to the project1 directory and issue the command and get this result:
>
> $grep -r string *.c
> grep: *.c: No such file or directory
> $
>
> The Annoyance: The '-r' option is supposed to recurse the subdirectories
> in the tree. BUT, it fails and stops the search because my current
> directory, project1, does not have any files that match '*.c' It does not
> recurse!
>
> I have gotten around this in the past by doing 'touch bogus.c' in the
> current directory so that it will not fail and will start recursing. But
> that is a lousy workaround.
>
> Is there a option to grep that I just don't understand yet that will make
> grep recurse even if the current directory doesn't have a match on the
> file expression?
----
there are 'other' forms of grep
I think that you will find 'agrep' in Dag's repository for FC-3 or
RHEL3/4 - I think you might find that there are others.
Craig