标签:style blog color div sp on c log size
awk
求和
cat data|awk ‘{sum+=$1} END {print "Sum = ", sum}‘
平均值
cat data|awk ‘{sum+=$1} END {print "Average = ", sum/NR}‘
最大值
cat data|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设置为一个差大数字
grep
sed
标签:style blog color div sp on c log size
原文地址:http://www.cnblogs.com/lovemyspring/p/3986740.html