How to Count RERR,RREP,RREQ and hello packets in ns2 from trace file?
Solution
use the awk scrpt like below,
BEGIN {
rreq = 0;
rrep = 0;
hello = 0;
rerr =0;
}
$0 ~/^s.*(REQUEST)/ {
rreq ++ ;
}
$0 ~/^s.*(REPLY)/ {
rrep ++ ;
}
$0 ~/^s.*(HELLO)/ {
hello ++ ;
}
$0 ~/^s.*(ERROR)/ {
rerr++ ;
}
END {
printf "Request Count:%d \n",rreq;
printf "Reply Count:%d \n",rrep;
printf "Hello Count:%d \n",hello;
printf "Rerr Count:%d \n",rerr;
}
}
Execute the code by typing: **awk -f "file.awk" "tracefile"**
No comments:
Post a Comment