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

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

Re: GAWK bug ?


From: Aharon Robbins
Subject: Re: GAWK bug ?
Date: Tue, 20 Jun 2006 05:44:23 +0300

Hi. You didn't send the full script, so I can't tell for sure, but I'm
guessing that what you want is

        BEGIN { IGNORECASE = 1 }

Also, the current gawk version is 3.1.5, you might try to upgrade.

Arnold

> Date: Mon, 19 Jun 2006 15:33:14 +0000
> From: Celsus English <address@hidden>
> Subject: GAWK bug ?
> To: address@hidden
> Cc: address@hidden
>
> Hi - methinks I found a bug in gawk - GNU Awk 3.1.3 (obtained from Internet) 
> running on MS-DOS.
>
> Simple script to add a new cell to rows in a comma-separated file if the 6th 
> field contains a specific string
> e.g. Add2csv String1 String2
> if field 6 contains "String1", create a new field (cell) at the end of the 
> record (row) containing "String2"
>
>
> Add2csv.bat contains
>
> gawk -F, -f Add2csv.txt -v PAR1=%1 -v PAR2=%2 Events.csv > work1.txt
> copy work1.txt Events.csv
>
>
> Add2csv.txt which works nicely DID contain
> {if ($6 !~ PAR1) print $0
>             else print $0","PAR2}
>
> However I wanted the matching to be case-insensitive so I tried to put
> IGNORECASE = 1
> at the start of Add2csv.txt
>
> This DOUBLED-UP the number of records output - each line was duplicated !!!
>
> I removed the IGNORECASE line and changed the 1st line to
> {if (tolower($6) !~ tolower(PAR1)) print $0
>
> which works OK.
>
> Regards,
> (Mr.) Celsus English
> Dublin, Ireland




reply via email to

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