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

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

Re: sub() function do'nt alter string length in awk 3.1.5


From: Aharon Robbins
Subject: Re: sub() function do'nt alter string length in awk 3.1.5
Date: Fri, 19 Jan 2007 15:12:05 +0200

Greetings. Concerning the bug report below.  I don't remember if I
have replied to it or not; if not I apologize for the long delay.
(I am starting to work my way backwards through a lot of saved
bug reports and am trying to deal with them.)

In any case, this is a bug; it only shows up in non-C locales with
the stock gawk 3.1.5.  Fortunately, the problem is fixed in my
current version, which is available via public CVS from
savannah.gnu.org.  Please check out a copy and double check
that it works for you.

I will be adding this test program to the test suite.

Much thanks!

Arnold

> Date: Sun, 28 May 2006 11:20:58 +0200
> From: Frantisek Hanzlik <address@hidden>
> Subject: sub() function do'nt alter string length in awk 3.1.5
> To: address@hidden
>
> Hello,
> I not know when it is my mistake or gawk bug - in simple example below
> I delete some chars from string variable, and after this string is
> modified, but its length is unchanged.
>
> awk 'BEGIN{A="1234567890abcdef";
>   for (i=1;i<6;i++){print length(A),"A=" A ".";sub("....","",A)}
> }'
> 16 A=1234567890abcdef.
> 16 A=567890abcdef.
> 16 A=90abcdef.
> 16 A=cdef.
> 16 A=.
>
> When I use gensub() instead of sub(), result is as I expected:
>
> awk 'BEGIN{A="1234567890abcdef";
>   for (i=1;i<6;i++){print length(A),"A=" A ".";A=gensub("....","",1,A)}
> }'
> 16 A=1234567890abcdef.
> 12 A=567890abcdef.
> 8 A=90abcdef.
> 4 A=cdef.
> 0 A=.
>
> OS/GAWK versions:
> - GNU/Linux kernel 2.6.16-1.2122_FC5 #1 i686, Fedora Core 5 distro
> - glibc-2.4-8
> - GNU Awk 3.1.5
>
> Yours sincerely
> Frantisek Hanzlֳ­k
>
> == Lucnֳ­ 502        Linux/Unix, Novell, Internet   Tel: +420-373729699 ==
> == 33209 Stenovice   e-mail:address@hidden     Fax: +420-373729699 ==
> == Czech Republic        http://hanzlici.cz/       GSM: +420-604117319 ==





reply via email to

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