[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GAWK bug ?
From: |
Celsus English |
Subject: |
GAWK bug ? |
Date: |
Mon, 19 Jun 2006 15:33:14 +0000 |
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
_________________________________________________________________
Find a baby-sitter FAST with MSN Search! http://search.msn.ie/
- GAWK bug ?,
Celsus English <=