Remember Remember

jueves, 23 de abril de 2009

Calculate the standard deviation (and average as well) via awk

This nice oneliner is very handy for calculating the standard deviation
gawk '{avg=avg+$2; sd2=sd2+($2*$2)} END{avg=avg/NR;sd2=sd2/NR; print avg" "sqrt(sd2-avg*avg)}'

0 comentarios:

Publicar un comentario

Suscribirse a Enviar comentarios [Atom]



<< Inicio