重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
求和
[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)"