The standards describe the
0 flag in generic
printf format arguments as follows:
Quote:
For a, A, d, e, E, f, F, g, G, i, o, u, x, and X conversion specifiers, leading zeros
(following any indication of sign or base) shall be used to pad to the field width
rather than performing space padding, except when converting an infinity or NaN.
If the '0' and '−' flags both appear, the '0' flag shall be ignored. For d, i, o, u,
x, and X conversion specifiers, if a precision is specified, the '0' flag shall be
ignored. For other conversion specifiers, the behavior is undefined.
Since the
s format conversion specifier is not in the above list and the
awk printf function description does not specify any changes to the generic
format rules that apply in this case, the behavior of
%05s is undefined and different versions of
awk are allowed to do anything they want in this case. It appears that the
awk you are using on your UNIX branded system uses the
0 flag to zero fill the string, the
awk you are using on your Linux distribution ignores the
0 in the format specification, and other versions of
awk might or might not exit with an illegal format specification error or drop core.