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 From: Chris Faylor Date: Mon, 18 Sep 2000 22:07:09 -0400 To: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: Re: Cyngus shell question Message-ID: <20000918220709.A26370@cygnus.com> Reply-To: cygwin AT sources DOT redhat DOT com Mail-Followup-To: "'cygwin AT sourceware DOT cygnus DOT com'" References: <02E689F991FFD311A75D009027B6A73E010AB6EC AT mail01 DOT nextcard DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.6i In-Reply-To: <02E689F991FFD311A75D009027B6A73E010AB6EC@mail01.nextcard.com>; from Gerald.LeRoy@nextcard.com on Mon, Sep 18, 2000 at 06:48:02PM -0700 On Mon, Sep 18, 2000 at 06:48:02PM -0700, Gerald Le Roy wrote: >This script isn't working for some reason and I don't understand why. > >awk 'BEGIN {FIELDWIDTHS = "31 8 41"} $1 ~ "^5" {seqid[NR - 2] = $2} END {for >(i = NR - 4; i > 0; i-- ) print seqid[i] }' %1 > > > >When I run it - it doesn't return anything - and - it echo's a script that >is different than the one I'm trying to run > > > C:\scripts>awk 'BEGIN {FIELDWIDTHS = "31 8 41"} $1 ~ "^5" >{seqid[NR - 2] = $2} END {for (i = NR - 4; i ; i-- ) print seqid[i] }' 365 > 1_taptran_savings.txt 1>0 > > >It may be that the shell is seeing the ">" symbol as a re-direct symbol >instead of as a 'greater than' symbol. I'm not sure how to get the shell >to recognize this as a greater than symbol. Can someone help - or re-direct >me (ha) to someone who can answer my question? I think you're right. Since you are executing this from a .bat file, Windows doesn't know that the ' character should quote a >. Only Cygwin recognizes ' as a quoting character and by the time cygwin gets the command line, it is too late because Windows has mangled it. Can you either change the outer quotes to be ", which Windows does recognize, or just put everything in a nice shell script and execute it as "sh foo", i.e. #/bin/sh exec awk 'BEGIN {FIELDWIDTHS = "31 8 41"} $1 ~ "^5" {seqid[NR - 2] = $2} END {for (i = NR - 4; i > 0; i-- ) print seqid[i] }' $1 ? cgf -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com