Hello,

in STABLE release of grml I found a bug reproducable with GNU awk 3.1.7 and 3.1.8. There is this code:

      awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
        /address/{if(found){address=$NF}}
        /netmask/{if(found){netmask=$NF}}
        /broadcast/{if(found){broadcast=$NF}}
        /gateway/{if(found){gateway=$NF}}
        /dns-nameservers/{if(found){dns-nameservers=$NF}}
        END{print address" "netmask" "broadcast" "gateway" "dns-nameservers}' /etc/network/interfaces >"$TMP"

But when it is executed it fails with:
awk: cmd. line:5:         /dns-nameservers/{if(found){dns-nameservers=$NF}}
awk: cmd. line:5:                                                    ^ syntax error

The reason I believe is that character "-" is not allowed in variable name in awk. When replacing the code with following, it works correctly:

      awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
        /address/{if(found){address=$NF}}
        /netmask/{if(found){netmask=$NF}}
        /broadcast/{if(found){broadcast=$NF}}
        /gateway/{if(found){gateway=$NF}}
        /dns-nameservers/{if(found){dnsnameservers=$NF}}
        END{print address" "netmask" "broadcast" "gateway" "dnsnameservers}' /etc/network/interfaces >"$TMP"

Regards,
Marek
--

Marek Malevič
www.malevic.cz
+420 608 116 896