Email List: Xaustin-group-lX
[All Lists]

Re: find + xargs

To: yyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Re: find + xargs
From: Andre Majorel <yyyyyyyy@xxxxxxxxx>
Date: Sun, 25 Mar 2001 16:20:07 +0200
References: <200103231720.RAA04194@squonk.unisoft.com>
On 2001-03-23 17:20 +0000, Geoff Clare wrote:

> I know of two existing solutions to the problem.  One is the GNU
> extension:
> 
>     find . -type f -print0 | xargs -0 some_command
> 
> which causes find to output null-terminated pathnames instead of
> newline-terminated ones, and causes xargs to read in null-terminated
> pathnames and to turn off its special handling of backslash and quotes.
> 
> The other existing solution is an extension to "find" to make it do
> the argument aggregation internally, so xargs is not needed:
> 
>     find . -type f -exec some_command {} +

Both would be good to have. If I had to choose one, I think I'd
take the -print0 one because it's more flexible. For example,

  find . -type f -print0 | sort -z | xargs -0 ...

Those extensions have been in actual use for years and have been
proven to work. In fact, they're vital.

-- 
André Majorel <yyyyyyyy@xxxxxxxxx>
http://www.teaser.fr/~amajorel/

<Prev in Thread] Current Thread [Next in Thread>