Go forward to Printf.
Go backward to Output Separators.
Go up to Printing.
Controlling Numeric Output with `print'
=======================================
When you use the `print' statement to print numeric values, `awk'
internally converts the number to a string of characters, and prints
that string. `awk' uses the `sprintf' function to do this conversion.
For now, it suffices to say that the `sprintf' function accepts a
"format specification" that tells it how to format numbers (or
strings), and that there are a number of different ways that numbers
can be formatted. The different format specifications are discussed
more fully in See Using `printf' Statements for Fancier Printing: Printf.
The built-in variable `OFMT' contains the default format
specification that `print' uses with `sprintf' when it wants to convert
a number to a string for printing. By supplying different format
specifications as the value of `OFMT', you can change how `print' will
print your numbers. As a brief example:
awk 'BEGIN { OFMT = "%d" # print numbers as integers
print 17.23 }'
will print `17'.