normalize() { cat - | gawk 'BEGIN{FS=OFS=","} NR>1{for(i=2;i<=NF;i++) $i = int(100*$i/(89*7)); print $0}'; } data() { cat <= Min) print NR,i }' Max=$2 Min=$1 } cols() { data | gawk -F, 'NR> 1{OFS="\t"; sum=0; for(i=2;i<=NF;i++) sum += $i; print $1,sum*100/(89*1*90)}'; } rows() { data | gawk -F, 'NR> 1{OFS="\t"; for(i=2;i<=NF;i++) sum[i] += $i} END{ for(i=2;i<=NF;i++) print sum[i]*100/(89*1*20) }'; } names() { data | gawk -F, 'NR==1 {SUBSEP=" "; for(i=2;i<=9;i++) mark(8,$i) for(i=10;i<=30;i++) mark(30,$i) for(i=31;i<=50;i++) mark(50,$i) for(i=51;i<=70;i++) mark(70,$i) for(i=71;i<=NF;i++) mark(90,$i) } END { report("learners",ls,lsall) report("preps",ps,psall) } function report(header,all,m) { print header OFS=" " for(key in keys) for(one in all) { n = ( (key,one) in m) ? m[key,one] : 0 print one,key,n } } function mark(key,str, l,p,tmp) { split(str,tmp,/-/) l = tmp[2] p = tmp[1] ls[l] ps[p] keys[key] psall[key,p]++ lsall[key,l]++ }' } names | tee names.out cols | cat -n > cols.dat rows | cat -n > rows.dat get 0 12.5 > 5.dat get 12.5 25 > 25.dat get 25 50 > 50.dat get 50 100 > 100.dat gnuplot<