For integer conversions, specifying a precision implies
that the output of the number itself should be zero-padded
to this width, where the 0 flag is ignored:
printf '<%.6d>', 1; # prints "<000001>"
printf '<%+.6d>', 1; # prints "<+000001>"
printf '<%-10.6d>', 1; # prints "<000001 >"
printf '<%10.6d>', 1; # prints "< 000001>"
printf '<%010.6d>', 1; # prints "< 000001>"
printf '<%+10.6d>', 1; # prints "< +000001>"
printf '<%.6x>', 1; # prints "<000001>"
printf '<%#.6x>', 1; # prints "<0x000001>"
printf '<%-10.6x>', 1; # prints "<000001 >"
printf '<%10.6x>', 1; # prints "< 000001>"
printf '<%010.6x>', 1; # prints "< 000001>"
printf '<%#10.6x>', 1; # prints "< 0x000001>"
####
printf "<%.2d>\n", 5;
printf "<%02.2d>\n", 4;
printf "<%02d>\n", 3;
printf "<%02.0d>\n", 2;
printf "<%0.2d>\n", 1;
printf "<%1.2d>\n", 0;
####
<05>
<04>
<03>
< 2>
<01>
<00>
####
For integer conversions, specifying a precision implies that the output of the number itself should be zero-padded to this width:
printf ’<%.6x>’, 1; # prints "<000001>"
printf ’<%#.6x>’, 1; # prints "<0x000001>"
printf ’<%-10.6x>’, 1; # prints "<000001 >"