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

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

Re: bug in gawk/gsub() (not present in nawk)


From: Stepan Kasal
Subject: Re: bug in gawk/gsub() (not present in nawk)
Date: Thu, 5 Jun 2003 09:37:27 +0200
User-agent: Mutt/1.2.5.1i

Hello,

On Thu, Jun 05, 2003 at 12:14:19AM -0400, Jose Nazario wrote:
> $ awk --version
> GNU Awk 3.0.3
> Copyright (C) 1989, 1991-1997 Free Software Foundation.

that is a really old version.
But I've found out gawk-3.1.1 contains this bug too (and thus probably
all releases between).

The latest release, 3.1.2, works correctly. (It contain new regex.c.)

>       gsub(/[\ \"-\/\\:;address@hidden,\$]/, "", $2)
>       print $2
> 
> in gawk, as found in netbsd-macppc/1.5.2, this will drop the first letter
> of every word. the resulting string will be "hissitleyitle", while in nawk
> as built on openbsd-3.3 this will get it correct.

I have found out that in gawk-3.0.3 and gawk-3.1.1, it's sufficient to
replace \/ by / so that the range "-/ is recognized correctly:

        gsub(/[\ \"-/\\:;address@hidden,\$]/, "", $2)

But there is no need to use so many backslashes, I'd use:

        gsub(/[ "-/\\:;address@hidden,$]/, "", $2)

HTH,
        Stepan Kasal




reply via email to

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