Subject: Re: Suggestion: inclusion of the truncate(1) utility into the tree
To: Andrew Brown <atatat@atatdot.net>
From: Kevin P. Neal <kpneal@pobox.com>
List: tech-userlevel
Date: 07/24/2000 12:25:34
On Mon, Jul 24, 2000 at 12:19:59PM -0400, Andrew Brown wrote:
> Kevin P. Neal wrote:
> >Wouldn't it be "more portable" if xargs was updated to be more complete?
> >HP-UX xargs allows for the substitution of a string with the input
> >given to xargs. The string to be substituted can be specified with an
> >additional argument. 
> >
> >find foo -type f -name \*.bar | xargs -iBAZ mv BAZ otherthere
> >
> >As near as I can tell offhand, GNU and HP-UX xargs support this.
> 
> wouldn't that cause one execution per argument?  if so, i'd be just as
> well off doing something like:
> 
> 	find foo -type f -name \*.bar | \
> 	sh -c 'while read i; do mv $i otherthere; done'

Hmmm. Looks like you are correct, it does cause one execution per argument.

That's a performance lose, but xargs is still more portable than a new
program.
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

"Nonbelievers found it difficult to defend their position in \ 
    the presense of a working computer." -- a DEC Jensen paper