bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Bug with for Loops on Arrays


From: Eli Zaretskii
Subject: Re: [bug-gawk] Bug with for Loops on Arrays
Date: Mon, 30 May 2011 08:23:55 -0400

> Date: Mon, 30 May 2011 10:37:13 +0200
> From: Martin Nattrodt <address@hidden>
> cc: bug-gawk <address@hidden>
> 
> GNU Awk 3.0.4
> Microsoft Windows [Version 6.1.7601](Windows 7 64 Bit)
> 
> Hello,
> I foud Bug wich gawk.
> the loop over an array has some stange behaviour.
> 
> Code example an result:
> 
> -------------------Begin Descriptin-----------------------
> /cygdrive/c # gawk '{split("X_B_T_IN",a,"_");for(i in a)print i;}' foo.txt
> 4
> 1
> 2
> 3
> 
> ------------------End Description----------------------
> I would expect the following output:
> X
> B
> T
> IN

Try this variant, and then I'm sure you will see what was wrong with
your program:

  gawk '{split("X_B_T_IN",a,"_");for(i in a)print a[i];}' foo.txt



reply via email to

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