awk实用技巧

awk '{sum+=$1} END {print "Sum = ", sum}'

awk '{sum+=$1} END {print "Average = ", sum/NR}'

awk 'BEGIN {max = 0} {if ($1>max) max=$1 fi} END {print "Max=", max}'

awk 'BEGIN {min = 1999999} {if ($1<min) min=$1 fi} END {print "Min=", min}' //min取值比所有的大即可

  

上一篇:新的三种EBS类型解析


下一篇:SpringMVC整合Shiro