hopcountdistribution
来自「大名鼎鼎的传感器网络仿真实验室平台SENSE」· 代码 · 共 53 行
TXT
53 行
#! /bin/bash## Show the distribution of hop counts by (source, destination) pairs.# This requires that the simulation be compiled with VISUAL_ROUTE defined.if [ $# -ne 1 ]; then echo "usage: $0 <fileName>" exit 1;fiinFile=$1temp=temp.$$grep VR $inFile > $temp.VRcat > $temp.awk <<EOFBEGIN { FS = ";";}{ gsub(" ", "", \$2);split( \$2, ids, "->");if( ids[1] < ids[2]){ src = ids[1]; dest = ids[2];}else{ src = ids[2]; dest = ids[1];}HCArray[ src, dest, \$5]++;}END { j = 1; for( i in HCArray) { ind[j] = i; j++; } n = asort( ind); printf( "%d\n", n); for( i = 1; i <= n; i++) printf("%s %d\n", ind[i], HCArray[i]);}EOFawk -F\; -f $temp.awk $temp.VR > $1.HCDistrm $temp.VR #$temp.awk
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?