delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT sources DOT redhat DOT com |
Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
X-Authentication-Warning: | makita.cygnus.com: keiths owned process doing -bs |
Date: | Tue, 4 Sep 2001 07:57:08 -0700 (PDT) |
From: | Keith Seitz <keiths AT cygnus DOT com> |
To: | =?iso-8859-1?q?hrishy?= <hrishys AT yahoo DOT co DOT uk> |
cc: | <cygwin AT cygwin DOT com> |
Subject: | Re: awk script compile problem |
In-Reply-To: | <20010904082945.44071.qmail@web12604.mail.yahoo.com> |
Message-ID: | <Pine.GSO.4.33.0109040747090.2403-100000@makita.cygnus.com> |
MIME-Version: | 1.0 |
On Tue, 4 Sep 2001, [iso-8859-1] hrishy wrote: > a few minutes ago i installed cygwin and i tried to > run the following program. I doubt very much that this worked on anything. This awk program clearly has an obvious syntax error. On RH7.0: keiths ~ >awk -f a.awk awk: a.awk:10: if (( $2 ~ /Label/ ) && ( $3 ~ /Not found/ )) { awk: a.awk:10: ^ parse error awk: a.awk:13: if (( $2 ~ /Form/ ) && ( $3 ~ /Not found/ )) { awk: a.awk:13: ^ parse error awk: a.awk:16: if (( $2 ~ /Report/ ) && ( $3 ~ /Not found/ )){ awk: a.awk:16: ^ parse error I also get similar errors on Solaris using its standard awk: keiths ~ >/usr/bin/awk -f a.awk awk: syntax error near line 10 awk: bailing out near line 10 The structure of an awk program looks like ("..." = statements): [BEGIN] { ... } { ... } [END] { ... } Not like what you have: { ... } ... END { ... } Add braces ("{","}") at the appropriate places and it will work just fine. > #BEGIN > { > FS="|" > } Add "{" here. > if (( $2 ~ /Label/ ) && ( $3 ~ /Not found/ )) { > label=label+1 > } > if (( $2 ~ /Form/ ) && ( $3 ~ /Not found/ )) { > form=form+1 > } > if (( $2 ~ /Report/ ) && ( $3 ~ /Not found/ )){ > report=report+1 > } Add "}" here. > END { print FILENAME, "\t" label "\t"form "\t" report > >>"result.log"} > > this program runs correctly under mkstoolkit and on my > linux box.but fails to under cygwin. > > with a parse error ^ if (( $2 ~ /Report/ ) && ( $3 > ~ /Not found/ )){ Keith -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |