delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/08/10:48:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <43204FFF.74CDAC16@dessent.net>
Date: Thu, 08 Sep 2005 07:51:43 -0700
From: Brian Dessent <brian AT dessent DOT net>
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: xargs still nok?
References: <on00i11u7d2a93lkl1hu98sav3kvi0c5cj AT 4ax DOT com> <20050908102658 DOT GC5555 AT calimero DOT vinschen DOT de> <4320281B DOT 6090005 AT lists DOT cichon DOT com> <uji0i1d0k7f1ehc6h48u2kr0e5kajmctpp AT 4ax DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

zzapper wrote:

> Is Xargs still reqd for
> 
> find . -name '*.cfm' -exec grep -i {} \;

It's not required, but using the above you will have to fork() and
exec() an individual copy of grep for each file, which will be
horrendously slow.   If you used xargs, it will call grep with as many
filenames as will fit on one command line, so that grep is actually
invoked as few times as is absolutely necessary.

It's the difference between:

grep -i foo bar00001.c
grep -i foo bar00002.c
...
grep -i foo bar00099.c # grep invoked 100 times

versus

grep -i foo bar00001.c bar00002.c ... bar00050.c
grep -i foo bar00051.c bar00052.c ... bar00099.c # grep invoked twice

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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