On Tue, 30 Dec 2014 01:07:27 +0000, Bruce Horrocks wrote:
> The statement:
>
> printf "%3$*d %2$d \n", 4, 5, 6
>
> results in
>
> .....6 5
>
> (where leading spaces have been replaced with dot.)
I guess that the following
gawk 'BEGIN{for (i=1; i<=10; i++){printf "%03$*d %2$d \n", 4, 5, i }}'
gives a clearer picture of your trouble. Only that according to my
reading of "Printf Ordering" section of gawk documentation you should be
using instead
gawk 'BEGIN{for (i=1; i<=10; i++){printf "%03$*1$d %2$d \n", 4, 5, i}}'
and that is likely more to your expectations.
It seems that the real issue is that the first form is not flagged as a
syntax error.
Michal