* NS Trace out format: + 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610 - 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610 r 1.84471 2 1 cbr 210 ------- 1 3.0 1.0 195 600 r 1.84566 2 0 ack 40 ------- 2 3.2 0.1 82 602 + 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611 - 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611 r 1.84609 0 2 cbr 210 ------- 0 0.0 3.1 225 610 + 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610 d 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610 - 1.8461 2 3 cbr 210 ------- 0 0.0 3.1 192 511 r 1.84612 3 2 cbr 210 ------- 1 3.0 1.0 196 603 + 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603 - 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603 + 1.84625 3 2 cbr 210 ------- 1 3.0 1.0 199 612 Here we see 14 trace entries, five enque operations (indicated by “+” in the first column), four deque operations (indicated by “-”), four receive events (indicated by “r”), and one drop event. The simulated time (in seconds) at which each event occurred is listed in the second column. The next two fields indicate between which two nodes tracing is happening. The next field is a descriptive name for the the type of packet seen. The next field is the packet’s size, as encoded in its IP header. The next field contains the flags, which not used in this example. Four of the flags are used for ECN: “C” for Ecn and “N” for Ecn-Capable in the IP header, and “A” for Congestion Action, and “E” for Congestion Experienced in the TCP header. For the other flags, “P” is for priority, and “F” is for TCP Fast Start. The next field gives the IP flow identifier field as defined for IP version 6. The subsequent two fields indicate the packet’s source and destination node addresses, respectively. The following field indicates the sequence number. The last field is a unique packet identifier. Each new packet created in the simulation is assigned a new, unique identifier. * To extract Totla number of TCP packets received during the 10th simulation second by NODE=3 using "awk": $awk 'int($2)==10 && $1=="r" && $5=="tcp" && $4==3 {pkt += $6} END {print pkt}' out.tr \----+----/ \--+--/ \---+---/ \-+-/ \---+---/ | | | | | | | | | | | | | | +-- add up packet size | | | | | | | +-- received only by node 3 | | | | | +-- count tcp packets only | | | +-- count recieved packets only | +-- count packets in 10th second To Repeat this for all 60 seconds, you can either type this 10 times in a shell file or use a shell script as follows: #!/bin/csh set i = 0 while ($i < 60) awk 'int($2)=='$i' && $1=="r" && $5=="tcp" && $4==3 {pkt += $6} END {print '$i'": " pkt}' out.tr set i = `expr $i + 1` end to use this, save it in a file (extract). then do: chmod 755 extract. then you can use it as command: extract. (To know more about shell script, you can lookup information in the web or from many UNIX books)