NS2_awk-ack_rec_wireless_upstream10/downstream10

|

BEGIN {
 
 total0 = 0;
 total1 = 0;
 total2 = 0;
 total3 = 0;
 total4 = 0;
 total5 = 0;
 total6 = 0;
 total7 = 0;
 total8 = 0;
 total9 = 0;
 
 nm0=(data+2);
 nm1=(data+3);
 nm2=(data+4);
 nm3=(data+5);
 nm4=(data+6);
 nm5=(data+7);
 nm6=(data+8);
 nm7=(data+9);
 nm8=(data+10);
 nm9=(data+11);
 
 SIMUL_TIME=500;
 AWK_INTERVAL=400;
}

{
   if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm0)) {
   if (n0 == 0) start0 = $2;
  
   total0 ++;
   end0 = $2;
  }
   if (1<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm1 )) {
   if (n1 == 0) start1 = $2;
  
   total1 ++;
   end1 = $2;
  }
  if (2<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm2  )) {
   if (n2 == 0) start2 = $2;
  
   total2 ++;
   end2 = $2;
  }
  if (3<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm3)) {
   if (n3 == 0) start3 = $2;
  
   total3 ++;
   end3 = $2;
  }
  if (4<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm4) ) {
   if (n4 == 0) start4 = $2;
  
   total4 ++;
   end4 = $2;
  }
  if (5<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm5) ) {
   if (n5 == 0) start5 = $2;
  
   total5 ++;
   end5 = $2;
  }
  if (6<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm6) ) {
   if (n6 == 0) start6 = $2;
  
   total6 ++;
   end6 = $2;
  }
  if (7<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm7) ) {
   if (n7 == 0) start7 = $2;
  
   total7 ++;
   end7 = $2;
  }
  if (8<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm8) ) {
   if (n8 == 0) start8 = $2;
  
   total8 ++;
   end8 = $2;
  }
  if (9<data)
  {
  if ( ($1 =="r") && ($4 =="AGT") && ($7 =="ack") && ($3 == nm9) ) {
   if (n9 == 0) start9 = $2;
  
   total9 ++;
   end9 = $2;
  }
  }
  }
  }
  }
  }
  }
  }
  }
  }
}

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


And