8.4.2 Conflicting options

The options ‘--max-lines’ (‘-L’, ‘-l’), ‘--replace’ (‘-I’, ‘-i’) and ‘--max-args’ (‘-n’) are mutually exclusive.

If some of them are specified at the same time, then xargs will generally use the option specified last on the command line, i.e., it will reset the value of the offending option (given before) to its default value. Additionally, xargs will issue a warning diagnostic on stderr.

$ seq 4 | xargs -L2 -n3
xargs: warning: options --max-lines and --max-args/-n are \
  mutually exclusive, ignoring previous --max-lines value
1 2 3
4

The exception to this rule is that the special max-args value 1 is ignored after the ‘--replace’ option and its short-option aliases ‘-I’ and ‘-i’, because it would not actually conflict.

$ seq 2 | xargs --replace -n1 echo a-{}-b
a-1-b
a-2-b