The awk script below is part of a bigger awk script, and this part attempts to print an Ip address that is in hex format in decimal format. I'm trying with following code but
I'm getting 0.0.0.0 and the correct answer is 192.168.140.100
When I try with your solutions there is no more as output like 0.0.0.0
When I try with my script I get the same 0.0.0.0.
I've done the following tests and it works when don't go the commas and work with single comma and without comma. It seems the issue begins when I try to convert variables that contain hex values.
The variables or constants need to be string "0x" plus a hex value string, e.g. "C0". That why your fourth attempt doesn't work - Z is assigned the number 0.
With double commas don't work when asigning a value to variable.
And if a variable has a hex value and I try to concatenate the value with "0x" and store in a 2nd variable, only prints "0x".
Awk does not have consistent support for hexadecimal values. With gawk try the --non-decimal-data option (or try something like Corona688 posted in the link in post #2)