#!/usr/local/bin/gawk -f { data[FNR] = $0 } END { for (i = 1; i <= FNR; i++) { mean += data[i] } mean /= FNR for (i = 1; i <= FNR; i++) { variance += (data[i]-mean)^2 } variance /= FNR sd = sqrt(variance) print "N =", FNR print "Mean =", mean print "Variance =", variance print "S.D. =", sd }