Path: utzoo!attcan!uunet!cbmvax!grr
From: grr@cbmvax.UUCP (George Robbins)
Newsgroups: comp.unix.ultrix
Subject: Re: xargs bug in 3.0
Message-ID: <7644@cbmvax.UUCP>
Date: 12 Aug 89 20:20:56 GMT
References: <2072@compugen.>
Reply-To: grr@cbmvax.UUCP (George Robbins)
Distribution: comp
Organization: Commodore Technology, West Chester, PA
Lines: 40

In article <2072@compugen.> john@compugen. (John Beaudin) writes:
> I couldn't get the following to work from a cmd line in either the
> sh or csh:
> 
> ls | xargs -i -t echo {} testing
> 
> All that happened was the line 'echo {} testing' printed once for
> every filename generated. Phoned Software Support; they confirmed the
> bug. Oh well, have to script it I suppose.

Ya get them to file an SPR?

It does seem quite broken, also the manual pages seem to say that the
default "replstr" is {|} while the System V manual pages specify the
more obvious {} token.  None of these work, nor does a simple -ix
substitution which would rule out "improvments" by the shell command
line interpretation.

Note that xargs(1) is a wretched System V kludge 8-), the same kind of
thing can be handlded in a very general manner by a pipeline consisiting
of  |  |  as in:

ls | sed -e 's/.*/echo & testing/' | sh

Substitution of find(1) for ls, gives you a fair amount file selection
capability, and while sed(1) can do most things under the sun, awk(1)
or other filters, or more than one filter, can often be used to advantage.

This method can also be used for tasks beyond the rather simplistic
capabilites of xargs, such as generating rename or other commands where
the arguments might be multiple functions of the input filenames.

Some people also use short c-shell or bourne shell loops entered at the
command line, however I find that history editing lets on use the
find/sed/sh style with much less retyping...

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)