switch in gawk
Amit Aronovitch
aronovitch at gmail.com
Thu May 14 10:02:54 IDT 2009
On Sun, May 10, 2009 at 11:50 PM, Omer Zak <w1 at zak.co.il> wrote:
>
> $ gawk 'END {switch(NR) {default: print NR}}' /dev/null
> gawk: END {switch(NR) {default: print NR}}
> gawk: ^ syntax error
>
> System:
> $ uname -a
> Linux c2 2.6.26-2-686 #1 SMP Thu Mar 26 01:08:11 UTC 2009 i686 GNU/Linux
>
> $ cat /etc/debian_version
> 5.0.1
> (this is Debian Lenny)
>
> $ gawk --version
> GNU Awk 3.1.5
> Copyright (C) 1989, 1991-2005 Free Software Foundation.
>
> $ dpkg -l | egrep gawk
> ii gawk 1:3.1.5.dfsg-4.1
>
On Debian, this was actually reported as bug and fixed - in version 3.1.6...
My guess is that other distros will do the same sooner or later.
So - right now this is not very portable, but I expect its use to spread in
the future, as most new features do.
see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=307510
console dump (Debian sid)---------->
amit at penguin:~$ gawk 'END {switch(NR) {default: print NR}}' /dev/null
0
amit at penguin:~$ lsb_release -i -r
Distributor ID: Debian
Release: unstable
amit at penguin:~$ dpkg --list gawk
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err:
uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii gawk 1:3.1.6.dfsg-2 GNU awk, a pattern scanning and processing
l
<-----------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20090514/0f383be0/attachment.html>
More information about the Linux-il
mailing list