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

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

Re: win32 recursive glob broken


From: Bob Proulx
Subject: Re: win32 recursive glob broken
Date: Fri, 23 Jan 2004 08:53:34 -0700
User-agent: Mutt/1.3.28i

John Calcote wrote:
> When you enter a recursive grep command such as:
>  
>   grep -r searchstring *.c
>  
> You will get an invalid parameter error if there are no files matching
> *.c in the current directory (there may be files below the current
> directory).

If you are using '-r' to search recursively then you probably don't
want to enter in a *.c pattern.  That would be really odd.  When would
a directory be named directory.c?  That seems very unlikely.

The -r option recursively searches any arguments that are directories.
Try this instead.

  grep -r searchstring .

Or

  grep -r searchstring ./somedirectory

If you want to restrict your files to only those that match a certain
suffix then 'find' is designed to do very specific file finding
operations.

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

Bob




reply via email to

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