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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

stdin if there are fewer than number lines left in the file the last time the<br />

command is run, xargs just uses what is there.<br />

With this option, a line must contain at least one nonblank character; blank<br />

lines are skipped and do not count toward the number of lines being added<br />

to the template. xargs considers a line to end at the first newline character,<br />

unless the last character of the line is a blank or a tab; in this case, the<br />

current line is considered to extend to the end of the next non-empty line.<br />

If you omit the –L or –l option, the default number of lines read from stdin<br />

is 1. The –x option is automatically in effect if –l is used.<br />

–l number<br />

Acts like the –L option, but the number argument is optional. number<br />

defaults to 1.<br />

–n number<br />

Specifies xargs is to read the given number of arguments from stdin and<br />

put them on the end of the command template. For example:<br />

xargs –n 2 diff<br />

obtains two arguments from stdin, appends them to the diff command, and<br />

then runs the command. It repeats this process until stdin runs out of<br />

arguments. When you use this option, xargs considers arguments to be<br />

strings of characters separated from each other by white-space characters<br />

(blanks, horizontal tabs, or newlines). Empty lines are always skipped (that<br />

is, they don’t count as arguments). If you want an input argument to contain<br />

blanks or horizontal tabs, enclose it in double quotes or single quotes. If the<br />

argument contains a double-quote character ("), you must enclose the<br />

argument in single quotes. Conversely, if the argument contains a single<br />

quote (’) (or an apostrophe), you must enclose the argument in double<br />

quotes. You can also put a backslash (\) in front of a character to tell xargs<br />

to ignore any special meaning the character may have (for example,<br />

white-space characters, or quotes).<br />

xargs reads fewer than number arguments if:<br />

xargs<br />

v The accumulated command line length exceeds the size specified by the<br />

–s option (or {LINE_MAX} if you did not specify –s)<br />

v The last iteration has more than zero, but less than number arguments<br />

remaining<br />

If you do not specify the –n option, the default number of arguments read<br />

from stdin is 1.<br />

Typically, an xargs command uses exactly one of the options just described. If you<br />

specify more than one, xargs uses the one that appears last on the command line.<br />

If the command has none of these options, xargs keeps reading input until it fills up<br />

its internal buffer, concatenating arguments to the end of the command template.<br />

When the buffer is full, xargs runs the resulting command, and then starts<br />

constructing a new command. For example:<br />

ls | xargs echo<br />

prints the names of files in the working directory as one long line. When you invoke<br />

xargs this way, the total length of all arguments must be less than the size<br />

specified by the –s option.<br />

Chapter 2. Shell command descriptions 817

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

Saved successfully!

Ooh no, something went wrong!