using awk to print average and standard deviation into a file

Hi I want to use awk to print avg and st deviation but it does not go into a file for column 1 only.

I can do average and # of records but i cannot get st deviation.

awk '{sum+=$1} END { print "Average = ",sum/NR}' 

thanks

$
$ cat f6
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-a)^2} sd = sqrt(ss/n); print "SD = "sd}' f6
SD = 30.3857
$
$

tyler_durden

Or a tad shorter:

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