# /* vim: set filetype=awk : */ -*- awk -*- BEGIN { Means=2; Sds=3; Ns=4; FS = OFS = ","; Limits[99] = 2.575; Limits[95] = 1.96; Trust = 95; } /^[ \t]*$/ {next} /^[ \t]*\#/ { print "ID","deltas("Trust"%)",$0; next } { X++; Line[X] = $0; M[X] = $Means; S[X] = $Sds; N[X] = $Ns; } END { report() } function report() { b4=1; for(i=1;i<=X; i++) { if (diff(M[b4],S[b4],N[b4],M[i],S[i],N[i])) { print i, "(" what(M[i],M[b4]) " " b4 ")", Line[i] b4=i; } else { print i, "(= " b4 ")", Line[i] } } } function what(m,n) { return m > n ? ">" : "<" } function abs(n) { return n < 0 ? -1*n : n } function z(m1,s1,n1,m2,s2,n2) { return (m1-m2)/sqrt((s1^2/(n1-1))+(s2^2/(n2-1)))} function diff(m1,s1,n1,m2,s2,n2) {return abs(z(m1,s1,n1,m2,s2,n2)) > Limits[Trust]}