MPE/iX Shell and Utilities Reference Manual, Vol 2
xargs(1) MPE/iX Shell and Utilities xargs(1)
NAME
xargs — construct and execute command lines
SYNOPSIS
xargs [–iplaceholder][–lnumber][–n number][–ptx][–eeofstr]
[–s size][command [argument ...] ]
DESCRIPTION
The xargs command line typically contains the skeleton or template of another command.
This template looks like a normal command, except that it is lacking some arguments. xargs
adds arguments from the standard input to complete the command, then executes the resulting
command. If more input remains, it repeats this process.
Options
xargs gets the needed arguments from the standard input. Different options tell how the
standard input is to be interpreted to obtain these arguments.
–iplaceholder
causes xargs to consider each full line in the standard input to be a single argument.
The placeholder following the –i is a string that can appear multiple times in the
command template. xargs strips the input line of any leading white space charac-
ters and inserts it in place of the placeholder string. For example, with
xargs -i’{}’ mv dir1/’{}’ dir2/’{}’
the standard input should consist of lines giving names of files that you want moved
from dir1 to dir2. xargs substitutes these names for the {} placeholder in each
place that it appears in the command template.
When xargs creates arguments for the template command, no single argument can
be longer than 255 characters after the input has replaced the placeholders. The –x
option (described below) is automatically in effect if –i is used. If you omit the
placeholder string, it defaults to the string {}. Thus, the previous example could be
written as
xargs -i mv dir1/’{}’ dir2/’{}’
–lnumber
reads number lines from the standard input and concatenates them into one long
string (with a blank separating each of the original lines). xargs then appends this
string to the command template and executes the resulting command. This process is
repeated until xargs reaches to the end of the standard input. If there are fewer than
number lines left in the file the last time the command is executed, xargs uses what-
ever is available.
Commands and Utilities 1-705