Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
xargs(1) OSS Shell and Utilities Reference Manual
NAME
xargs - Constructs argument lists and runs commands
SYNOPSIS
xargs [-e eof_string][-i][replace_string] | [-I replace_string] | [-r][-l][number] |[-
L number] |[-n number][-ptx][-s size][command][argument ...]
The xargs command constructs a command line by combining a command string, containing
a command and its flags or arguments with additional arguments read from standard input.
FLAGS
-e eof_string
Sets the logical End-of-File string to eof_string. By default, there is no logical End-
of-File. The xargs command reads standard input until it encounters either an End-of-
File character or the logical EOF string.
-i[replace_string]
This flag is the same as -I. The default replace_string for -i is {}.
The -i, -I, and -r flags are mutually exclusive; the last one of these flags specified takes
effect.
-I replace_string
Takes an entire line as a single argument and inserts it in each instance of
replace_string found in the command string. A maximum of five arguments in the
command string can each contain one or more instances of replace_string. The xargs
command discards spaces and tabs at the beginning of each line. The argument con-
structed cannot be larger than 255 bytes. This flag also turns on the -x flag.
The -i, -I, and -r flags are mutually exclusive; the last one of these flags specified takes
effect.
-l[number]
This flag is the same as -L. The default number is 1. This flag turns on the -x flag.
The -l, -L, and -n flags are mutually exclusive; the last one of these flags specified
takes effect.
-L number
Runs the command string with the specified number of nonempty argument lines read
from standard input. The last invocation of the command string can have fewer argu-
ment lines if fewer than number remain. A line ends with the first newline character
unless the last character of the line is a space or a tab. A trailing space or tab indicates
a continuation through the next nonempty line.
The -l, -L, and -n flags are mutually exclusive; the last one of these flags specified
takes effect.
-n number
Executes the command string using as many standard input arguments as possible, up
to a maximum of number (a positive decimal integer). The xargs command uses fewer
arguments if their total length is greater than the number of characters specified by the
-s size flag (or LINE_MAX if there is no -s flag). It also uses fewer arguments for the
last invocation if fewer than number arguments remain. When -x is present, each
number argument must fit the length limitation specified by -s. When the replacement
string {} is in effect for the -i flag (the deafult), the maximum number of input argu-
ments that can be substituted is 1. Therefore, the use of the -n flag in this case has no
effect.
10−32 Hewlett-Packard Company 527188-004