I am trying to convert a number to a string in awk. I would like my string to be left-padded with zeros. E.g., 3 would become "00000003". I have the following test case:
gawk 'BEGIN { CONVFMT = "%08d" ; a = 233 ; print ""a }'
233
It prints "233" not "00000233". Replacing a = 233 with a = 233.0 doesn't change anything. However, replacing a = 233 with a = 233.1 changes everything, and my one-liner correctly prints padded string:
gawk 'BEGIN { CONVFMT = "%08d" ; a = 233.1 ; print ""a }'
00000233
What am I missing ???