From owner-freebsd-questions@FreeBSD.ORG Thu Apr 26 06:31:46 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 1893416A404 for ; Thu, 26 Apr 2007 06:31:46 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (imap.infracaninophile.co.uk [81.187.76.162]) by mx1.freebsd.org (Postfix) with ESMTP id 6DE9813C4BF for ; Thu, 26 Apr 2007 06:31:45 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost.infracaninophile.co.uk [IPv6:::1]) by smtp.infracaninophile.co.uk (8.14.1/8.14.1) with ESMTP id l3Q6VUmb073237; Thu, 26 Apr 2007 07:31:30 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) Authentication-Results: smtp.infracaninophile.co.uk from=m.seaman@infracaninophile.co.uk; sender-id=permerror; spf=permerror X-SenderID: Sendmail Sender-ID Filter v0.2.14 smtp.infracaninophile.co.uk l3Q6VUmb073237 Message-ID: <46304742.8060205@infracaninophile.co.uk> Date: Thu, 26 Apr 2007 07:31:30 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.0 (X11/20070420) MIME-Version: 1.0 To: Irsla References: <20070425072914.GA65634@thought.org> <462F0824.5000107@infracaninophile.co.uk> In-Reply-To: X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (smtp.infracaninophile.co.uk [IPv6:::1]); Thu, 26 Apr 2007 07:31:40 +0100 (BST) X-Virus-Scanned: ClamAV 0.90.2/3162/Wed Apr 25 19:43:55 2007 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_POLICY_TESTING, DK_POLICY_SIGNSOME,NO_RELAYS autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on happy-idiot-talk.infracaninophile.co.uk Cc: FreeBSD Mailing List 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 06:31:46 -0000 -----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-----