[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] FW: Problems when post-processing a NAM file
Hi all,
Yesterday I sent this message to the mailing list. I had made quite an obvious mistake in the awk file but that is not the problem. I te end of the mail I've copied the "correct" awk file, which still seems to have a problem.
--------------
I'm trying to calculate the average delay and the jitter of two traffic flows when running from nodes 0 and 1 to node 3. I've written an awk script to calculate these statistics but when I run on Linux Red Hat 6.0 "gawk -f delay.awk out.nam > delay.txt" I get the following messages:
warning: BEGIN blocks must have an action part.
warning: END blocks must have an action part.
Any ideas of why am I getting these messages? When I look into the output file it's empty.
Any suggestions will be greatly appreciated.
Thanks and best regards,
Jorge
This is my awk script:
BEGIN
{
llegadas1 = 0;
llegadas2 = 0;
}
{
if (($1 == "+") && ($5 == "0") && ($17 == "1"))
{
tsalida1[$15] = $3;
salidas1++;
}
if (($1 == "+") && ($5 == "1") && ($17 == "2"))
{
tsalida2[$15] = $3;
salidas2++;
}
if (($1 == "r") && ($7 == "3") && ($17 == "1"))
{
tllegada1[$15] = $3
llegadas1++;
printf(llegadas1);
}
if (($1 == "r") && ($7 == "3") && ($17 == "2"))
{
tllegada2 [$15] = $3
llegadas2++;
printf(llegadas2);
}
}
END
{
for (i=1;i<=salidas1;i++) if (tllegada[i]) average1 = average1 + (tllegada1 - tsalida1)/llegadas1;
for (i=1;i<=salidas2;i++) if (tllegada[i]) average2 = average2 + (tllegada2 - tsalida2)/llegadas2;
print (average1);
print (average2);
}
Thanks a lot for your help.
Jorge Manrique
UPC Graduate Student
Spain
PD: Muchas gracias por tu respuesta �lvaro. Creo que el problema es otro; he leido que en algunos sistemas END y BEGIN no funcionan. �Puede ser que ocurra eso con el Linux Red Hat 6? Mil gracias,
Jorge