On Mon, Jan 16, 2017 at 12:19:31PM +0100, Andreas Kusalananda Kähäri wrote:
> I've found an issue with xargs.
>
>
>
>
>
> This works as expected:
>
>
>
>
>
> $ printf 'hello\nworld\n' | xargs -I arg printf '>%s<\n' "arg"
>
>
> >hello<
>
>
> >world<
>
>
>
>
>
> However, when I use nul-termination instead:
>
>
>
>
>
> $ printf 'hello\00world\00' | xargs -0 -I arg printf '>%s<\n' "arg"
>
>
> >hello world<
>
>
I got curious and looked into this:
xargs works as described in the manpage: It invokes the command on
each LINE of input. If yout replace the delimiter in your first
example by tab or space, it also starts all tokens in one command.
To get the result, which you expected, you have to use the parameter
"-n 1" additionally.