delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/04/07:55:47

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
Subject: Re: awk script compile problem
From: Marco Craveiro <soupdragon AT clix DOT pt>
To: hrishy <hrishys AT yahoo DOT co DOT uk>
Cc: cygwin AT cygwin DOT com
In-Reply-To: <20010904082945.44071.qmail@web12604.mail.yahoo.com>
References: <20010904082945 DOT 44071 DOT qmail AT web12604 DOT mail DOT yahoo DOT com>
Message-Id: <999604298.1351.43.camel@darkroom>
Mime-Version: 1.0
X-Mailer: Evolution/0.12 (Preview Release)
Date: 04 Sep 2001 12:53:57 +0100

On 04 Sep 2001 09:29:45 +0100, hrishy wrote:
> Hello
> 
> a few minutes ago i installed cygwin and i tried to
> run the following program.
> 
> #This is the awk script that will be called by main.sh
> #the feild separator is |
> #Created by Hrishikesk Samant
> #Created on 08-Aug-2001
> #BEGIN
> { 
> 	FS="|" 
> }
> 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
> }
> 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/  )){
> 
> can somebody tell me whats wrong??
> 
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
> 
> --
> 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/
> 
> 
IIRC from my gawk days, you dont need the if when defining a rule in
gawk, just the rule itself:

(( $2  ~  /Label/ )  &&  ( $3  ~  /Not found/ )) 
{
        label=label+1
} 

you can still use ifs but they are normally placed in the body of the
rule. if standard awk works diferently, you can always set gawk to
behave like awk doing --compat, i think - but the man page is your
friend. a good place to look for differences is also the info manual,
its very complete.

hope it helps.

-- 
be as one already dead -- tokkotai saying


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019