Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] GNU xargs trick



Rich Pieri <richard.pieri at gmail.com> writes:

> On 4/27/2016 12:31 PM, Mike Small wrote:
>> New line characters in particular. -I changes matters to line at a
>> time so other space characters should be okay, right?
>
> Yes, line at a time, but you may need to quote the substitution string
> in the command arguments.

I wondered about that but when I tried a little experiment it seemed
like it's probably not necessary. When I "cat | xargs -I{} ls {}" and
type some two word lines the files ls complains of being missing do seem
to be the two word "files" I'm typing. Seems like maybe what xargs gets
(i.e. the expansion of {}) goes right to one of the exec library calls
without further shell intervention. Let me know if I'm wrong on this. I
continue to find the various Unix shell expansions too complicated to
keep in my head at once or retain over time. And unfortunately I'm not
getting any smarter as I age.

On this topic, the debian bug report where GNU Parallels came into being
as a debian package has some interesting discussion re. GNU parallel and
xargs and another thing called parallel from moreutils. Early in the
discussion there's the question of what parallel can do that xargs
cannot:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518696

-- 
Mike Small
smallm at sdf.org



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org