From owner-freebsd-questions@FreeBSD.ORG Thu Apr 26 10:17:03 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F3F3216A401 for ; Thu, 26 Apr 2007 10:17:02 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout1.cac.washington.edu (mxout1.cac.washington.edu [140.142.32.134]) by mx1.freebsd.org (Postfix) with ESMTP id CE90413C45D for ; Thu, 26 Apr 2007 10:17:02 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.33.9] (may be forged)) by mxout1.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l3QAH267031835 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Apr 2007 03:17:02 -0700 X-Auth-Received: from [192.168.100.45] (c-67-161-171-107.hsd1.ca.comcast.net [67.161.171.107]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l3QAH1jn003545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Apr 2007 03:17:02 -0700 Message-ID: <46307C24.6010908@u.washington.edu> Date: Thu, 26 Apr 2007 03:17:08 -0700 From: Garrett Cooper User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: FreeBSD Mailing List References: <20070425072914.GA65634@thought.org> <462F0824.5000107@infracaninophile.co.uk> <46304742.8060205@infracaninophile.co.uk> In-Reply-To: <46304742.8060205@infracaninophile.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.1.294258, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2007.4.26.30434 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __LINES_OF_YELLING 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Subject: Re: first of misc questions.... 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: Thu, 26 Apr 2007 10:17:03 -0000 Matthew Seaman wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Irsla wrote: >> Hi, >> >> On 4/25/07, Matthew Seaman wrote: >>> find . -type f \( -mtime 6 -o -mtime 29 \) -print0 | xargs -0 vi >>> >> what about the -exec option of find ? I always wonder why people don't >> use it. >> >> find . -type f \( -mtime 6 -o -mtime 29 \) -exec vi {} \; >> > > The critical difference is that 'find | xargs foo' runs foo once[*], > to process all the files in one go. 'find -exec foo {}' runs foo one > time for each matched file. In this case, it's probably not a big > deal, but when you need to process hundreds of files 'find | xargs > foo' is much more efficient. > > Cheers, > > Matthew > > [*] Actually, it runs foo repeatedly with as many filenames on the > foo command line as it can each time. That's generally several > hundred files at a go. > > - -- > Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard > Flat 3 > PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate > Kent, CT11 9PW > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.3 (FreeBSD) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFGMEdC8Mjk52CukIwRCC97AJwPY6m5uHCQ/AvdnyjceQZDDtvmngCgi0RV > Im64VTob1mZRGtczhMIAaRQ= > =RaJi > -----END PGP SIGNATURE----- Doesn't -xargs prebuffer input via xargs, where -exec does exec on the fly? -Garrett