awk计算最大最小平均值

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}'

你可能感兴趣的:(awk计算最大最小平均值)