Open kinglion580 opened 6 years ago
awk 'BEGIN{ OFMT="%.3f"; devf="/proc/net/dev"; while(("cat "devf) | getline) { if($0 ~ /:/ && ($10+0) > 0) { split($1,tarr,":"); net[tarr[1]]=$10+tarr[2]; print tarr[1],$10+tarr[2]; } } //close(devf); } function convert(flow,conver){ k=1024 m=1024^2 g=1024^3 if(flow>=k&&flow<m){ flow=flow/k conver="KB" } else if(flow>=m&&flow<g){ flow=flow/m conver="MB" } else flow=flow/g conver="GB" return flow conver } '