Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Weird awk processing



On 05/02/2013 03:52 PM, Jerry Feldman wrote:
> On 05/02/2013 01:11 AM, David Rosenstrauch wrote:
>> Just stumbled upon the most bizarre awk problem.  mawk and gawk are
>> showing 2 different results for the same code.  Can anyone shed any
>> light?
>>
>> TIA!
>>
>> DR

> I get the same results from the 2. The first thing I did was to run
> sample.txt through sed to convert the spaces to tabs. Certainly the
> correct result is the gawk result you got.

The issue apparently only occurred in certain versions of mawk.  (Most 
notably v1.3.3, which was installed onto my Ubuntu server.)

I (with some help from others) managed to pinpoint the issue earlier 
today, fortunately:  apparently mawk was interpreting "32e56067" and 
"32e56122" as numbers coded in scientific notation, interpreting them 
both as infinity, and then deciding they were equal!  The fix was to 
change this line:

curr_label=$1;

to this:

curr_label=""$1;

to force mawk to interpret $1 as strings.  Go figure!

Thanks,

DR




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org