aboutsummaryrefslogtreecommitdiff
path: root/average.sh
blob: 7fef93df57582f76db4d5bbfe9ca28f44efcb538 (plain)
1
2
3
4
5
6
#!/bin/bash

awk '{for(i=1;i<=NF;i++) {sum[i] += $i; sumsq[i] += ($i)^2}} 
          END {for (i=1;i<=NF;i++) {
          printf "%f %f \n", sum[i]/NR, sqrt((sumsq[i]-sum[i]^2/NR)/NR)}
         }'