16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

|<br />

xargs<br />

xargs — Construct an argument list and run a command<br />

Format<br />

Description<br />

Options<br />

xargs [–I placeholder] [–i [placeholder]] [–L number] [–l [number]] [–n number]<br />

[–ptx] [–E [eofstr]] [–e [eofstr]] [–s size] [command [argument ...]]<br />

The xargs command line typically contains the skeleton, or template, of another<br />

command. This template looks like a normal command, except that it lacks some<br />

arguments. xargs adds arguments from standard input (stdin) to complete the<br />

command, then runs the resulting command. If more input remains, it repeats this<br />

process.<br />

In a doublebyte locale, some options may accept a doublebyte string as an<br />

argument. In these cases, an incorrect doublebyte string would be detected during<br />

command-line parsing.<br />

xargs gets the needed arguments from stdin. Different options tell how stdin is to<br />

be interpreted to obtain these arguments.<br />

–I placeholder<br />

Specifies that each line in stdin be considered as a single argument. The<br />

placeholder following the –I is a string that can appear multiple times in the<br />

command template. xargs strips the input line of any leading white-space<br />

characters and inserts it in place of the placeholder string. For example,<br />

with:<br />

xargs –I ’{}’ mv dir1/’{}’ dir2/ ’{}’<br />

stdin should consist of lines giving names of files that you want moved<br />

from dir1 to dir2. xargs substitutes these names for the {} placeholder in<br />

each place that it appears in the command template.<br />

When xargs creates arguments for the template command, no single<br />

argument can be longer than 255 characters after the input has replaced<br />

the placeholders. The –x option is automatically in effect if –I or –i is used.<br />

If you omit the placeholder string, it defaults to the string { }. Thus we<br />

could write our preceding example as:<br />

xargs –i mv dir1/ ’{}’ dir2/ ’{}’<br />

In a doublebyte locale, placeholder may contain doublebyte characters.<br />

–i placeholder<br />

Behaves like –I, except that the placeholder is optional. If you omit the<br />

placeholder string, it defaults to the string { }. Thus, the previous example<br />

could be written as:<br />

xargs –i mv dir1/ ’{} ’ dir2/’{ } ’<br />

xargs –i /{}/ mv dir1/ ’{}’ dir2/ ’{}<br />

–L number<br />

Specifies that xargs read number lines from stdin and concatenate them<br />

into one long string (with a blank separating each of the original lines).<br />

xargs then appends this string to the command template and runs the<br />

resulting command. This process is repeated until xargs reaches the end of<br />

816 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!