This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: grep -r : permission denied


CROWLEY CAL schrieb am 2001-09-17, 22:23:

>
>"Gerrit P. Haase" wrote:
>
>> 
>> I have a little wrapper for recursive greps. Call it 'rgrep' and
>> save it to /bin. Now you should be able to call:
>> 
>> $ rgrep SaerchTerm
>> 
>> rgrep:
>> ======
>> #!/usr/bin/sh
>> # grep $@ recursive
>> find . -type f -exec grep $@ {} /dev/null \;
>                 ^^^^^^^^^^^^^
>this will fork/exec for each filename the find generates.
>it is much more efficient to use xargs like this:
>  find . -type f -print | xargs grep $@
>which uses xargs to bundle up as many files as possible
>to pass to grep w/o overflowing the command-line buffer.
>(at least this is so on every UNIX system I have worked
>on in the past 14 years -- hope this is still true with
>Cygwin as well ;-).

Good point.  This works about 100 times faster:)

Gerrit


-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]