Next: , Previous: Escapes, Up: Print File Information

3.2.2 Format Directives

-printf’ and ‘-fprintf’ support the following format directives to print information about the file being processed. The C printf function, field width and precision specifiers are supported, as applied to string (%s) types. That is, you can specify "minimum field width"."maximum field width" for each directive. Format flags (like ‘#’ for example) may not work as you expect because many of the fields, even numeric ones, are printed with %s. The format flag ‘-’ does work; it forces left-alignment of the field.

%%’ is a literal percent sign. See Reserved and Unknown Directives, for a description of how format directives not mentioned below are handled.

A ‘%’ at the end of the format argument causes undefined behaviour since there is no following character. In some locales, it may hide your door keys, while in others it may remove the final page from the novel you are reading.