It is equivalently important to understand the ns-2 output trace format and have some knowledge on how to extract relevant information for your research. This exercise is dedicated to familiarize you with ns-2's output format, in particular by namtrace-all, and techniques to do trace post-processing.
As a result of previous exercise, we obtain an output file, out.nam. It contains information of all packets enqueued (+), dequeued (-), transmitted over to another hop (h), and etc.
Extracting Useful Information
Extract information from the out.nam file and compute the total bytes
of TCP (tcp) and UDP (cbr) traffic over link 4-3 for the duration of
the simulation. Then, compute total TCP and UDP/CBR traffic in bytes
and ratios of TCP and UDP/CBR to the total. Finally, Comment on the
bandwidth share of TCP vs. UDP/CBR.
awk '$1=="r" && ??==4 && ??==3 && $9=="??" {a += ??} END {print a}'
References: