Re: specify a multiple of m arguments in xargs

2020-03-08 Thread Andreas Metzler
On 2020-03-08 Peng Yu wrote: > I don't think the `xargs -n 4` in the middle is robust. For example, > when the input contains spaces, it won't work as expected. Is there a > way to make it robust? NUL as delimiter? cu Andreas

Re: specify a multiple of m arguments in xargs

2020-03-08 Thread Peng Yu
I don't think the `xargs -n 4` in the middle is robust. For example, when the input contains spaces, it won't work as expected. Is there a way to make it robust? $ printf '%s\n' {a..d} | xargs -n 4 a b c d $ printf '%s\n' 'a b' 'c d' 'e f' 'g h' | xargs -n 4 a b c d e f g h On 3/8/20, James Y

Re: specify a multiple of m arguments in xargs

2020-03-08 Thread James Youngman
You should be able to do this by chaining use of xargs :- $ seq 1 208 | xargs -n 4 | xargs -d'\n' -n 5 sh -c 'set $@; my-command $@' ignored The use of -n in the second xargs invocation is not needed, it's just there to show more clearly what is happening.