awk 'BEGIN{print 1.2.3.4}'
1.20.30.4
Can anyone explain why has extra "0" in the IP address?
awk 'BEGIN{print 1.2.3.4}'
1.20.30.4
Can anyone explain why has extra "0" in the IP address?
Because it's printing the concatenation of 3 floating point numbers: 1.2, 0.3, and 0.4. If you want to print the ip address, quote it so that it's parsed as a string.
Regards,
Alister
but why awk think that's 3 floating numbers, not a string? Is the bug in it?
$ awk 'BEGIN{print "1.2.3.4"}'
1.2.3.4