genplothost.awk

来自「OMNET++仿真三色算法的源码,三色算法是无线传感器中一个典型的分簇算法」· AWK 代码 · 共 34 行

AWK
34
字号
/*compute the delivery rate h <speed, sent, delivered> point*/NR == 1		{			h = $2;			sp = $1			samples = 1;		}NR >1 		{			if( sp != $1)  			{				printf"%d \t %.2f\n", sp, h /samples;							/* reinitialize the variables  */				h = $2;				sp = $1;				samples = 1;			}			else			{				h += $2;				samples ++;			}		}END		{			/* print the last row that otherwise wouldn't be printed */						printf"%d \t %.2f\n", sp, h /samples;		}		

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?