From owner-freebsd-questions@FreeBSD.ORG Mon Jun 9 19:08:19 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA6821065681 for ; Mon, 9 Jun 2008 19:08:19 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 252298FC34 for ; Mon, 9 Jun 2008 19:08:18 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl116-224.kln.forthnet.gr [77.49.235.224]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-4) with ESMTP id m59J7fM1015057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 9 Jun 2008 22:07:49 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m59J7eDf066867; Mon, 9 Jun 2008 22:07:40 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m59J7XUf066827; Mon, 9 Jun 2008 22:07:33 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Ian Smith References: Date: Mon, 09 Jun 2008 22:07:31 +0300 In-Reply-To: (Ian Smith's message of "Tue, 10 Jun 2008 01:44:36 +1000 (EST)") Message-ID: <87y75efmvg.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: m59J7fM1015057 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.746, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.65, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No X-Mailman-Approved-At: Mon, 09 Jun 2008 19:15:34 +0000 Cc: Jos Chrispijn , Wojciech Puchar , Bill Campbell , freebsd-questions@freebsd.org, Raphael Becker Subject: Re: Grep Guru X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jun 2008 19:08:19 -0000 On Tue, 10 Jun 2008 01:44:36 +1000 (EST), Ian Smith wrote: >On Sun, 8 Jun 2008 16:07:12 -0700 Bill Campbell wrote: >>On Mon, Jun 09, 2008, Raphael Becker wrote: >>>On Sun, Jun 08, 2008 at 10:15:50PM +0200, Wojciech Puchar wrote: >>>> find . -type f -print0|xargs -0 grep >>> >>> There's no more need for find | xargs >>> >>> Try: >>> >>> find . -type -f -exec grep {} \+ >>> >>> -exec foo {} \+ behaves like xargs foo >>> -exec foo {} \; exec foo for every file > > Thanks for this kick; I'd missed or misunderstood using {} \+ > >> The issue here is that grep execs grep for each file found while >> xargs batches the files. > > If find(1) is to be believed, so does -exec utility [argument ...] {} + Yes, sure. I think Bill was just being extra-conservative[1] and he explicitly chose to quote `+' with a backslash to avoid spurious interpreration by the shell. I also type `\+' out of habbit most of the time. [1] BSD users tend to be this way, but that's a good thing, right? :)