Your conversion modifier is the problem. The 'x' conversion modifier takes an integer argument and converts it to unsigned lowercase hexadecimal notation.
But I think its converting to a signed Hexadecimal number not to "unsigned lowercase hexadecimal " my friend..
as -1 in singed hexadecimal number is equal to ffffffff
and like wise if I will give printf("%x", -10);
which will give me a output fffffff6 . As -10 in signed hexadecimal number is equal to fffffff6 .
I think its depend on machine whether it is a 32 bit or 64 bit machine ,
But my problem is I want to take only the last 3 digits of the hexadecimal number ..
Ex: printf("%x", -10); sholud give me output ff6 not fffffff6 .
I am curious to know is there any format specifier in nawk or gawk in which I can get only the last three digits.