MPE/iX Shell and Utilities Reference Manual, Vol 2

xargs(1) MPE/iX Shell and Utilities xargs(1)
With this option, a line must contain at least one non-blank character; blank lines are
skipped and do not count towards the number of lines being added to the template.
xargs considers a line to end at the first newline character, unless the last character
of the line is a blank or a tab, in which case, the current line is considered to extend
to the end of the next non-empty line.
If you omit the –l option, the default number of lines read from standard input is 1.
The –x option (described below) is automatically in effect if –l is used.
–n number
reads a maximum of number arguments from the standard input and puts them on the
end of the command template. For example, in
xargs -n 2 diff
obtains two arguments from the standard input, appends them to the diff command,
and executes the command. When you use this option, xargs considers arguments
to be strings of characters separated from each other by white space characters
(blanks, horizontal tabs, or newlines). Empty lines are always skipped (that is, they
don’t count as arguments).
If you want an input argument to contain blanks or horizontal tabs, enclose it in
double quotes or apostrophes. If the argument contains a double quote character ("),
you must enclose the argument in apostrophes. Conversely, if the argument contains
an apostrophe (), you must enclose the argument in double quotes.. You can also
put a backslash (\) in front of a character to tell xargs to ignore any special mean-
ing the character may have (for example, white space characters, or quotes).
xargs reads fewer than number arguments if:
the accumulated command line length exceeds the size specified by the –s op-
tion (or {LINE_MAX} if you did not specify –s)
the last iteration has more than zero, but less than number arguments remain-
ing.
A typical xargs command uses exactly one of the preceding If you specify more than one,
xargs uses the one that appears last on the command line. If you do not specify any of these
options, xargs keeps reading input until it fills up its internal buffer, concatenating argu-
ments onto the end of the command template. When the buffer is full, xargs executes the re-
sulting command, then starts constructing a new command. For example,
ls | xargs echo
prints the names of files in the current directory as one long line. When you invoke xargs in
this way, the total length of all arguments must be less than the size specified by the –s option
(described below).
1-706 Commands and Utilities