Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)

User Commands (p - r) printf(1)
The following backslash-escape sequences are supported:
\Oddd, where ddd is a zero-, one-, two-, or three-digit octal number
that is converted to a byte with the numeric value specied by the octal
number.
The escape sequences previously listed under the description of the
format argument. These are converted to the individual characters they
represent.
The \c sequence, which is not displayed and causes the printf com-
mand to ignore any remaining characters in the string parameter con-
taining it, any remaining string parameters, and any additional charac-
ters in the format argument.
c Accepts an integer value and converts it to an unsigned character. The result-
ing byte is printed.
d, i Accepts an integer value and converts it to signed decimal notation in the style
[-]dddd. The precision species the minimum number of digits to appear. If the
value being converted can be represented in fewer digits, it is expanded with
leading zeros. The default precision is 1. The result of converting a 0 (zero)
value with a precision of 0 (zero) is a null string. Specifying a eld width with
a 0 (zero) as a leading character causes the eld width value to be padded with
leading zeros.
e, E Accepts a oat or double value and converts it to the exponential form [-]
d.dde+|- dd. There is one digit before the radix character (shown here as the
decimal point), and the number of digits after the radix character is equal to the
precision specication. The LC_NUMERIC locale category determines the
radix character to use in this format. If no precision is specied, then six digits
are output. If the precision is 0 (zero), then no radix character appears. The E
conversion character produces a number with E instead of e before the
exponent. The exponent always contains at least two digits. However, if the
value to be printed requires an exponent greater than two digits, additional
exponent digits are printed as necessary.
f Accepts a oat or double value and converts it to decimal notation in the for-
mat [-] ddd.ddd. The number of digits after the radix character (shown here as
the decimal point) is equal to the precision specication. The LC_NUMERIC
locale category determines the radix character to use in this format. If no preci-
sion is specied, then six digits are output. If the precision is 0 (zero), then no
radix character appears.
g, G Accepts a oat or double value and converts it in the style of the f or e conver-
sion characters (or E in the case of the G conversion), with the precision speci-
fying the number of signicant digits. Trailing zeros are removed from the
result. A radix character appears only if it is followed by a digit. The style used
depends on the value converted. Style g results only if the exponent resulting
from the conversion is less than -4 or it is greater than or equal to the precision.
o Accepts an integer value and converts it to unsigned octal notation. The preci-
sion species the minimum number of digits to appear. If the value being con-
verted can be represented in fewer digits, it is expanded with leading zeros.
The default precision is 1. The result of converting a 0 (zero) value with a pre-
cision of 0 (zero) is a null string. Specifying a eld width with a 0 (zero) as a
527188-007 Hewlett-Packard Company 735