* Cyngus shell question
@ 2000-09-18 18:45 Gerald Le Roy
2000-09-18 19:08 ` Chris Faylor
0 siblings, 1 reply; 2+ messages in thread
From: Gerald Le Roy @ 2000-09-18 18:45 UTC (permalink / raw)
To: 'cygwin@sourceware.cygnus.com'
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?
Thanks,
Gerald LeRoy
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Cyngus shell question
2000-09-18 18:45 Cyngus shell question Gerald Le Roy
@ 2000-09-18 19:08 ` Chris Faylor
0 siblings, 0 replies; 2+ messages in thread
From: Chris Faylor @ 2000-09-18 19:08 UTC (permalink / raw)
To: 'cygwin@sourceware.cygnus.com'
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@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-09-18 19:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-18 18:45 Cyngus shell question Gerald Le Roy
2000-09-18 19:08 ` Chris Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).