Following is the error I am getting when running the attached awk file.

awk: measure-loss.awk:2: 'in expressionss.awk:2: ^ invalid char '

I gave the command awk -f measure-loss.awk pmp.tr
Following is the sample record from my pmp.tr file:
s 1.375051200 _0_ AGT  --- 0 cbr 512 [] ------- [1:0 0:0 32 0]  [0]  0  0
r 2.000054006 _1_ AGT  --- 0 cbr 512 [] ------- [1:0 0:0 32 0]  [0]  0  0
and I am pasting below the measure-loss.awk file:

It is used to calculate pakcet loss:

BEGIN {

# Initialization. Set two variables. fsDrops: packets drop. numFs: packets
sent

        fsDrops = 0;

        numFs = 0;
    numFr = 0;

}

{

   action = $1;

   time = $2;

   from = $3;

   to = $4;

   type = $5;

   pktsize = $6;

   flow_id = $8;

   src = $9;

   dst = $10;

   seq_no = $11;

   packet_id = $12;



        if (from==0 && to==AGT && action == "s")

                numFs++;

        if (from==1 && to==AGT && action == "r")

                numFr++;
    fsDrops= numFs-numFr;


}

END {

        printf("number of packets sent:%d lost:%d\n", numFs, fsDrops);

}

Can anyone suggest me on what could have been  the mistake? I would
appreciate if someone can help me as it is very urgent.
THanks in advance.

Thanx
Shaili Desai
Master's Candidate
Telecommunications and Management
University of Maryland,College Park,USA

Reply via email to