bug-gnu-utils
[Top][All Lists]
Advanced

[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: Mahendra Ladhe
Subject: RE: gawk always prints 0 for a hexadecimal number printed using printf %d
Date: Thu, 6 Nov 2008 19:24:09 -0800

Thanks John for your clarification.
Is it possible to consider this as an enhancement request,
if it fits the overall philosophy and goals of awk?
As seen in my original mail, the awk version 1.2 present on
Ubuntu Linux and written by Mike Brennan (brennan at whidbey dot com)
supports this.

Thanks,
Mahendra Ladhe

-----Original Message-----
From: John Cowan [mailto:address@hidden 
Sent: Friday, November 07, 2008 8:38 AM
To: Mahendra Ladhe
Cc: address@hidden
Subject: Re: gawk always prints 0 for a hexadecimal number printed using
printf %d

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]