Shell awk 求标准差

时间:2015-06-06 11:50:41   收藏:0   阅读:3042

cat > temp0001
80
25
57
98
95
78
92
18
77
19


 awk ‘{x[NR]=$0; s+=$0; n++} END{a=s/n; for (i in x){ss += (x[i]-a)^2} sd = sqrt(ss/n); print "SD = "sd}‘ temp0001
SD = 30.3857

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!