delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/18/07:47:32

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: "Gerrit P. Haase" <gp AT familiehaase DOT de>
Organization: Esse keine toten Tiere
To: CROWLEY CAL <crowleyc AT home DOT com>
Date: Tue, 18 Sep 2001 13:17:58 +0200
MIME-Version: 1.0
Subject: Re: grep -r : permission denied
Reply-to: gp AT familiehaase DOT de
CC: cygwin AT cygwin DOT com
Message-ID: <3BA74986.27704.280BC6C8@localhost>
In-reply-to: <3BA6DA61.A4AF16A@home.com>
X-mailer: Pegasus Mail for Win32 (v3.12cDE)
X-Hops: 1
X-Sender: 320081107336-0001 AT t-dialin DOT net

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019