十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
求和
[root@114 ~]# cat data.log
1
2
3
6
7
[root@114 ~]# awk '{a+=$1}END{print a}' data.log
19
平均值
[root@114 ~]# awk '{a+=$1}END{print a/NR}' data.log
3.8
大值
awk 'BEGIN{max=-1111111111}{if($2>max)max=$2}END{print max}' log.data
7
最小值
[root@112 ~]# awk 'BEGIN{max=1111111111}{if($2
awk '{print $2}' log.data |python -c "import sys;nums=[int(i) for i in sys.stdin.readlines()];print max(nums) "
awk '{print $2}' log.data |python -c "import sys;nums=[int(i) for i in sys.stdin.readlines()];print min(nums) "
awk '{print $2}' log.data |python -c "import sys;nums=[int(i) for i in sys.stdin.readlines()];print sum(nums)/len(nums) "
awk '{print $2}' log.data |python -c "import sys;nums=[int(i) for i in sys.stdin.readlines()];print sum(nums)"