public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* awk problem with embedded awk scripts...
@ 2000-06-02  5:08 Christian Jönsson FOA Informationsöverföring
  0 siblings, 0 replies; only message in thread
From: Christian Jönsson FOA Informationsöverföring @ 2000-06-02  5:08 UTC (permalink / raw)
  To: cygwin

I have a problem with running a test suite of a network simulator 
( http://www-mash.cs.berkeley.edu/ns/ns.html ) and I have been told 
before to suspect binary mount / text file problems with awk but who 
knows.

This is what I get as output:
ns: _o4 finish_flows test_flows_unforced: awk.exe: cmd. line:4:
        print "
awk.exe: cmd. line:4:                               ^ unterminated string
    while executing
"exec awk [$self $awkprocedure_] $flowfile >@ $outdesc"
    (procedure "_o4" line 26)
    (TestSuite create_flow_graph line 26)
    invoked from within
"$self create_flow_graph $testname $flowgraphfile"
    (procedure "_o4" line 6)
    (TestSuite finish_flows line 6)
    invoked from within
"_o4 finish_flows test_flows_unforced"

and the tcl file containing the supposedly malfunctioning awk (code) has 
this:

TestSuite instproc allmakeawk { } {
    set awkCode {
        BEGIN {prev=-1; tot_bytes=0; tot_packets=0; forced_total=0; unforced_total=0}
        {
            if ($5 != prev) {
                print " "; print "\"flow ",$5;
                prev = $5
            }
            tot_bytes = $19-$11;
            forced_total= $16-$14;
            tot_packets = $10;
            tot_arrivals = $9;
            unforced_total = $14;
            if (unforced_total + forced_total > 0) {
                if ($14 > 0) {
                    frac_packets = tot_packets/$14;
                }
                else { frac_packets = 0;}
                if ($17-$15 > 0) {
                    frac_bytes = tot_bytes/($17-$15);
                }
                else {frac_bytes = 0;} 
                if ($13 > 0) {
                    frac_arrivals = tot_arrivals/$13;
                }
                else {frac_arrivals = 0;}
                if (frac_packets + frac_bytes > 0) {
                    unforced_total_part = frac_packets * unforced_total / ( unforced_total + forced_total)
                    forced_total_part = frac_bytes * forced_total / ( unforced_total + forced_total)
                    print 100.0 * frac_arrivals, 100.0 * ( unforced_total_part +forced_total_part)
                }
            }
        }
    }
    return $awkCode
}

The problem is at print " "; print "\"flow ",$5; The first print 
statement when passed from tcl script code to the awk program hits 
something nasty. Now, the tcl used is a native (binary release) of 
tcl8.0.5 for win32...

Any help or hint is greatly appreciated. 

TIA,

/ChJ


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-06-02  5:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-02  5:08 awk problem with embedded awk scripts Christian Jönsson FOA Informationsöverföring

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).