Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 To: =?iso-8859-1?q?hrishy?= cc: Subject: Re: awk script compile problem In-Reply-To: <20010904082945.44071.qmail@web12604.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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/