[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strange behavour with combining -i with -n 1 for xargs
From: |
Koopal, Andre |
Subject: |
strange behavour with combining -i with -n 1 for xargs |
Date: |
Fri, 22 Oct 2021 14:22:34 +0200 |
I tried the following which didn't work as expected:
% echo a b c | gxargs -n 1 -i echo before {} after
before a b c after
Without -i it uses the arguments by itself, but of course at the end
% echo a b c | gxargs -n 1 echo before {} after
before {} after a
before {} after b
before {} after c
Just -i does what I expect, but I needed them separate:
% echo a b c | gxargs -i echo before {} after
before a b c after
After playing a bit more I find that if the arguments are on lines by
itself it does work:
% /usr/bin/echo 'a\nb\nc' | gxargs -i -n 1 echo before {} after
before a after
before b after
before c after
Which if more complicated you can solve with xargs as well:
akoopal@asostats0-47% echo a b c | gxargs -n 1 | gxargs -n 1 -i echo before
{} after
before a after
before b after
before c after
This seems like a bug to me, can you investigate?
Regards,
André Koopal
--
<http://www.verizon.com>
André Koopal
System engineer
Infrastructure Management & Security
Global Operations | Verizon Wireline Network
O +31 20 711 6990
andre.koopal@nl.verizon.com
<http://www.facebook.com/verizon> <http://twitter.com/verizon>
<http://www.linkedin.com/company/verizon>
<http://www.instagram.com/verizon>
======================================================================
Verizon Nederland B.V. - H.J.E. Wenckebachweg 123, 1096 AM, Amsterdam, the
Netherlands - Commercial Register No. 34199467
- strange behavour with combining -i with -n 1 for xargs,
Koopal, Andre <=