$ cat bin/stats.gawk #!/usr/bin/gawk -f { d = $1 ~ /^[0-9]/; } d && !f { M = $1; m = $1; f = 1; } d && $1 > M { M = $1; } d && $1 < m { m = $1; } d { c += 1; s += $1; ss += $1*$1; } END { OFS = "t"; a = s/c; print "cnt,min,max,sum,avg,stdev:", c, m, M, s, a, sqrt(ss/c-a**2); }
Ejemplo de uso:
$ ls -s1 | ./stats.gawk cnt,min,max,sum,avg,stdev: 53 4 33064 78860 1487.92 6125.08