[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this a bug in gnu awk or am I doing something wrong?
From: |
Dave B |
Subject: |
Re: Is this a bug in gnu awk or am I doing something wrong? |
Date: |
Fri, 3 Jul 2009 19:29:11 +0100 |
User-agent: |
KMail/1.9.10 |
On Friday 03 July 2009, Stuart Hartley wrote:
> Type:
> awk -v id=60050768018100824800000000001888 -F: '($7 == id) { print
> $0 }' /tmp/Steve.txt
> Returns:
> 0:Q1B_A0110:5:561:T2_UNXA0110_030:10000000C945B14E:
> 60050768018100824800000000001887
> 0:Q1B_A0110:6:562:T2_UNXA0110_031:10000000C945B14E:
> 60050768018100824800000000001888
> 0:Q1B_A0110:7:563:T2_UNXA0110_032:10000000C945B14E:
> 60050768018100824800000000001889
> 2:unxa0073:3:216:T3_UNXA0073_004:10000000C94FEC92:6005076801810082480000000
>0001979
I think this has something to do with numeric comparison (I see the same with
gawk 3.1.6 on Linux x86_64 btw), since if you test $7~id (regex match) or
$7""==id"" (forced string match) it works correctly.
I'm not sure what the exact problem could be, but it seems that, for large
enough but differing numbers, the internal awk representation ends up being
the same (probably due to limited floating point precision), so the $7==id
comparison succeeds.
Probably A. Robbins will be able to provide a better explanation and further
details.
--
D.