Go forward to Control Letters.
Go backward to Printf.
Go up to Printf.
Introduction to the `printf' Statement
--------------------------------------
The `printf' statement looks like this:
printf FORMAT, ITEM1, ITEM2, ...
The entire list of arguments may optionally be enclosed in parentheses.
The parentheses are necessary if any of the item expressions uses a
relational operator; otherwise it could be confused with a redirection
(see Redirecting Output of `print' and `printf': Redirection.). The
relational operators are `==', `!=', `<', `>', `>=', `<=', `~' and `!~'
(see Comparison Expressions: Comparison Ops.).
The difference between `printf' and `print' is the argument FORMAT.
This is an expression whose value is taken as a string; it specifies
how to output each of the other arguments. It is called the "format
string".
The format string is the same as in the ANSI C library function
`printf'. Most of FORMAT is text to be output verbatim. Scattered
among this text are "format specifiers", one per item. Each format
specifier says to output the next item at that place in the format.
The `printf' statement does not automatically append a newline to its
output. It outputs only what the format specifies. So if you want a
newline, you must include one in the format. The output separator
variables `OFS' and `ORS' have no effect on `printf' statements.