Date: Thu, 26 Apr 2007 03:17:08 -0700 From: Garrett Cooper <youshi10@u.washington.edu> To: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: first of misc questions.... Message-ID: <46307C24.6010908@u.washington.edu> In-Reply-To: <46304742.8060205@infracaninophile.co.uk> References: <20070425072914.GA65634@thought.org> <462F0824.5000107@infracaninophile.co.uk> <ed5f4bce0704251331v735ccedet947318e8d2a6fbe1@mail.gmail.com> <46304742.8060205@infracaninophile.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Seaman wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Irsla wrote: >> Hi, >> >> On 4/25/07, Matthew Seaman <m.seaman@infracaninophile.co.uk> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46307C24.6010908>