BEGIN { highest_packet_id=0; } { Event=$1; Time=$2; Tx=$3; Rx=$4; Packet=$12; Type=$5; Bytes=$6; Initial_Tx=$9; Initial_Rx=$10; if(Packet>highest_packet_id) highest_packet_id=Packet; if(Type=="tcp" && Packet>"100") { if (Event=="+" && ((Tx=="0" && Rx=="2") || (Tx=="1" && Rx=="2")) ) { start_time[Packet]=Time; } if (Event=="r" && ((Tx=="3" && Rx=="4") || (Tx=="3" && Rx=="5")) ) { end_time[Packet]=Time; } if (Event=="d" && Initial_Tx=="0.0" && Initial_Rx=="4.0") { end_time[Packet]=-1; dropped_pckts_04++; } if (Event=="d" && Initial_Tx=="1.0" && Initial_Rx=="5.0") { end_time[Packet]=-1; dropped_pckts_15++; } } } END { for(packet_id=0;packet_id<=highest_packet_id;packet_id++) { if (start_time[packet_id] 4 = %f\n",dropped_pckts_04); printf("Dropped packets 1 -> 5 = %f\n",dropped_pckts_15); }