[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk always prints 0 for a hexadecimal number printed using printf %
From: |
John Cowan |
Subject: |
Re: gawk always prints 0 for a hexadecimal number printed using printf %d |
Date: |
Thu, 6 Nov 2008 22:08:11 -0500 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Mahendra Ladhe scripsit:
> when a field on a line which is a hexadecimal number(preceded by 0x)
> is printed using printf with %d format specifier, gawk always prints
> 0 instead of the value of the field in the decimal format.
That is because awk's string-to-number conversion (unlike the Awk language
itself) does not understand "0x..." strings, so it converts just the
initial numeric part, which is "0".
--
Principles. You can't say A is John Cowan <address@hidden>
made of B or vice versa. All mass http://www.ccil.org/~cowan
is interaction. --Richard Feynman