bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] Is this a bug


From: Seppo Lehtikangas
Subject: [bug-gawk] Is this a bug
Date: Sat, 08 Mar 2014 12:44:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Hi!

I have been using some time to find annoying error in my awk-code.

I had to strip almost the whole code to find the error because awk tells me that there is syntax-error on else-statement(line 12) while the fact is that error is on if-statement(line 9).

Is there some bug or do I have to learn other way interpreted error messages?

My code:
===============
#! /usr/bin/awk -f
# ~bin/iftest
#
{
#printf "%s %s %s %s \n", ARGV[0], ARGV[1], ARGV[2], ARGV[3]

#if (NF == 0) print "usage iftest [1 | anything]"

If ($1 == 1)
   {print "number one"
    printf "%s\n", $0}
else
   {if (NF == 0)
       {print "empty row"}
    else
       {print "non one"
       printf "%s\n", $0}}
}
===============
running code gives:
========
iftest test
awk: /mnt/L6EVM/seppo/bin/iftest.error:12: else
awk: /mnt/L6EVM/seppo/bin/iftest.error:12: ^ syntax error
========

Regards

Seppo Lehtikangas
Enebyberg
Sweden



reply via email to

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