#assumes incoming column is mmre values (already x 100) BEGIN { IGNORECASE = 1; # Ignore case in string comparisons. FS = ","; # Initialize the field separator. #OFS = ","; # Initialize the output field separator. Pred = 30; # Initialize the range for Pred. } { Mre=$1 SumMre += Mre; SumMreSq += Mre^2; if (Mre < Pred) PredN++ } END { Mmre = SumMre/NR; Pred30 = 100*PredN/NR; SdMre = sd(SumMreSq,SumMre,NR); #SdMre = 100*sd(SumMreSq,SumMre,NR); #print Mmre, SdMre, Pred30; print Mmre, SdMre, Pred30; #print Mmre, SdMre; } function sd(sumSq,sumX,n) { return sqrt((sumSq-((sumX*sumX) / n)) / (n-1)) }