how to pass "one" argument and use it twice in "xargs" command how to pass "one" argument and use it twice in "xargs" command bash bash

how to pass "one" argument and use it twice in "xargs" command


If you can't change the input format, you could set the delimiter to a space:

$ echo -n {0..4} | xargs -d " " -I@ echo @,@0,01,12,23,34,4

Otherwise, change the input to separate the tokens with a newline:

$ printf "%s\n" {0..4} | xargs -I@ echo @,@0,01,12,23,34,4

The reason for this syntax is explained in man xargs

-I replace-strReplace occurrences of replace-str in the  initial-arguments  with  names  read  fromstandard input.  Also, unquoted blanks do not terminate input items; instead the sepā€arator is the newline character.  Implies -x and -L 1.

So you must set the delimiter manually to a space if you want to delimit fields.