ref: aede08934f1721a2386a325c8f1dae0b483c20ab
dir: /calc.awk/
#!/bin/awk -f # meant to be executed within acme with records that look like this: # 5 , 3 # 2 , 1 NF == 3 && $2 == "," { score = $1 explvl = $3 fac = score * explvl weightedsum += fac puresum += score if (explvl > 5) { sumexperienced += score numexperienced++ } else { sumunexperienced += score numunexperienced++ } purecount++ weightedcount += explvl printf "%s\n", $0 } END { printf "%.2f / %d = %f (weighted)\n", weightedsum, weightedcount, weightedsum/weightedcount printf "%.2f / %d = %f\n", puresum, purecount, puresum/purecount printf "experienced: %d → %f\n", numexperienced, sumexperienced/numexperienced printf "unexperienced: %d → %f\n", numunexperienced, sumunexperienced/numunexperienced }