bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] gawk array problem


From: Ludek Bican
Subject: [bug-gawk] gawk array problem
Date: Wed, 06 Apr 2016 21:01:05 +0200 (CEST)

Hi,

 there is some problem with arrays

Regards,

Ludek
email: address@hidden

---------------------------------------------

$ uname -a
Linux ub1 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 
x86_64 x86_64 GNU/Linux

$ awk --ver | head -1
GNU Awk 4.0.1

$ dpkg -l gawk | tail -2  | cut -c 1-60
+++-====================-==========================-====
ii  gawk                                                        
1:4.0.1+dfsg-2.1ubuntu2                             amd6

----------------------------------------
$ cat 1.txt
add  1
add  2
del 3
del 1
---------------------------------------
$ awk '
  /add/ { M[$2]++; print "++ "$2 }
  /del/ && M[$2] { delete M[$2]; print "-- "$2 }        
  END { for (I in M) print "stay "I }                     
' 1.txt
--------------------------------------
==== output:
++ 1
++ 2
-- 1
stay 2
stay 3    # ???????





reply via email to

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