[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] AWK fails deleting member from associative array.
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] AWK fails deleting member from associative array. |
Date: |
Sat, 4 Jan 2014 10:27:37 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Jan 04, 2014 at 04:58:27AM +0100, Sebastian Kricner wrote:
> Is this issue known?
What issue? There is a bug in your code. Your delete statement
failed because you had already changed the value of $i.
Try this patch:
--- acronyms.awk 2014-01-04 10:21:06.172274718 -0500
+++ acronyms.fixed.awk 2014-01-04 10:26:14.381356142 -0500
@@ -13,8 +13,9 @@ FILENAME == "acronyms" {
{
if($i in acronyms)
{
- $i = acronyms[$i] " ("$i")";
- delete acronyms[$i];
+ a = acronyms[$i]
+ delete acronyms[$i]
+ $i = (a " ("$i")")
}
}
}
That should fix your issue.
Regards,
Andy