awk计算最大最小平均值

2018-01-31 11:01:22来源:https://www.jianshu.com/p/dc3da9fdeb0d作者:秋刀鱼杂记人点击

分享

awk计算最小值


cat stream.txt | grep Triad | awk 'NR==1{min = $2;next} {if ($2<=min) min=$2 fi} END {print "min=", min}'



awk计算最大值


cat stream.txt | grep Triad | awk 'NR==1 {max =$2 ;next} {if ($2>max) max=$2 fi} END {print "max=", max}'



awk求和


cat iperf.txt | grep sender | awk '{sum+=$7} END {print sum}'



awk计算平均值


cat iperf.txt | grep sender | awk '{sum+=$7} END {print sum/NR}'






最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台