NS2_awk-ack_send_wireless_upstream10/downstream10

|

BEGIN {
 n=0;
 total0 = 0;
 total1 = 0;
 total2 = 0;
 total3 = 0;
 total4 = 0;
 total5 = 0;
 total6 = 0;
 total7 = 0;
 total8 = 0;
 total9 = 0;
 throughput=0;
 nm=data;
 SIMUL_TIME=500;
 AWK_INTERVAL=400;
}

{
 if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm+2)) {
   if (n == 0) start = $2;
   total0 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (1<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 3))) {
   if (n == 0) start = $2;
   total1 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (2<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 4))) {
   if (n == 0) start = $2;
   total2 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (3<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 5))) {
   if (n == 0) start = $2;
   total3 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (4<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 6)) ) {
   if (n == 0) start = $2;
   total4 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (5<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 7)) ) {
   if (n == 0) start = $2;
   total5 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (6<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 8)) ) {
   if (n == 0) start = $2;
   total6 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (7<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 9)) ) {
   if (n == 0) start = $2;
   total7 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (8<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 10)) ) {
   if (n == 0) start = $2;
   total8 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  if (9<nm)
  {
  if ( ($1 =="s") && ($4 =="AGT") && ($7 =="ack") && ($3 == (nm + 11)) ) {
   if (n == 0) start = $2;
   total9 ++;
   n +=1;
   #print n,"\t",$0;
   end = $2;
  }
  }
  }
  }
  }
  }
  }
  }
  }
  }
}

END {
 print total0;
 print total1;
 print total2;
 print total3;
 print total4;
 print total5;
 print total6;
 print total7;
 print total8;
 print total9;
print "============================================================";
}


And