[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] "The GNU AWK User's Guide" Section 11.2.1.2 - example pro
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] "The GNU AWK User's Guide" Section 11.2.1.2 - example program error, maybe |
Date: |
Sat, 24 Sep 2011 21:15:11 +0300 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi. Apologies for the long delay in replying to this.
> From: "address@hidden" <address@hidden>
> To: address@hidden
> Date: Tue, 16 Aug 2011 11:31:57 -0600
>
> I believe I've found a problem with an example program in "The GNU AWK
> User's Guide" Section 11.2.1.2 Controlling Array Scanning Order
>
> The example appears to have 2 problems:
>
> $ gawk 'BEGIN {
> > a[4] = 4
> > a[3] = 3
> > for (i in a)
> > print i, a[i]
> > }'
> -| 4 4
> -| 3 3
> $ gawk 'BEGIN {
> > PROCINFO["sorted_in"] = "@str_ind_asc"
> > a[4] = 4
> > a[3] = 3
> > for (i in a)
> > print i, a[i]
> > }'
> -| 3 3
> -| 4 4
> __________________
>
> In line 10, of the example, I believe the author meant to use the special
> value ="@ind_str_asc"
You are correct. I have fixed the document.
> The other issue is that I have run these routines on two systems and
> the results are the same
>
> > 4 4
> > 3 3
> unlike the example, where the second run sorts the rows in ascending order.
As was pointed out, I believe, by someone else, you are using too old
a version of gawk. The sorting features are new in gawk 4.0. 3.1.5 is
quite old and you should upgrade.
Much thanks for the report!
Arnold
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gawk] "The GNU AWK User's Guide" Section 11.2.1.2 - example program error, maybe,
Aharon Robbins <=