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.

printf<br />

printf — Write formatted output<br />

Format<br />

Description<br />

printf format [argument ...]<br />

printf writes the argument operands to standard output, formatted according to the<br />

format operand.<br />

format is a format string composed of conversion specifications that convert and<br />

add the next argument to the output. format can contain backslash-escape<br />

sequences. These conversions are similar to those used by the ANSI C standard.<br />

Conversion specifications have the form:<br />

%[flag][width]<br />

[precision][char]<br />

where flag is one of the following:<br />

− Left-justifies the field; default is right justification.<br />

+ Always prefixes a signed value with a sign (+ or −).<br />

space Reserves a character position at the start of the string for the minus sign<br />

(for negative numbers) or a space (for positive numbers). If both space and<br />

− appear as flags, the space flag is ignored.<br />

# Prefixes octal values with 0 and hexadecimal values with 0x or 0X. For<br />

floating-point values, this causes the decimal point always to be displayed<br />

even if no characters follow it.<br />

0 Pads numeric values with leading zeros. If both 0 and − appear as flags,<br />

the 0 flag is ignored.<br />

width is the minimum field width of the output field. If the converted value is shorter<br />

than the minimum width, printf pads it with spaces or zeros.<br />

In a string, precision is the maximum number of bytes to be printed from the string;<br />

in a number, the precision is the number of digits to be printed to right of the<br />

decimal point in a floating-point value. width or precision can be specified as *, in<br />

which case the value is read from the next argument, which must be an integer. For<br />

example:<br />

printf "%*.*d\n" 20 10 200<br />

is equivalent to:<br />

printf "%20.10d\n" 200<br />

The conversion character char is one of the following:<br />

b A string that may contain a backslash-escape sequence. Valid escape<br />

sequences are described in<br />

c Single character of an integer value; the first character of a string.<br />

d Decimal integer.<br />

e,E Floating point (scientific notation).<br />

f,F Floating point.<br />

g,G The shorter of e and f (suppresses nonsignificant zeros).<br />

i Decimal integer.<br />

o Unsigned octal integer.<br />

514 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!