The notation for spaces allows some flexibility for application output. Note that an empty character position in format represents one or more <blank> characters on the output (not white space, which can include <newline> characters). Therefore, another utility that reads that output as its input must be prepared to parse the data using scanf(), awk, and so on. The '' character is used when exactly one <space> is output.
The treatment of integers and spaces is different from the printf() function in that they can be surrounded with <blank> characters. This was done so that, given a format such as:
the implementation could use a printf() call such as:
and still conform. This notation is thus somewhat like scanf() in addition to printf().
The printf() function was chosen as a model because most of the standard developers were familiar with it. One difference from the C function printf() is that the l and h conversion specifier characters are not used. As expressed by the Shell and Utilities volume of POSIX.1-2008, there is no differentiation between decimal values for type int, type long, or type short. The conversion specifications %d or %i should be interpreted as an arbitrary length sequence of digits. Also, no distinction is made between single precision and double precision numbers ( float or double in C). These are simply referred to as floating-point numbers.
Many of the output descriptions in the Shell and Utilities volume of POSIX.1-2008 use the term ``line'', such as:
"%s", <input line>
Since the definition of line includes the trailing <newline> already, there is no need to include a '\n' in the format; a double <newline> would otherwise result.
return to top of page