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.