ref: c9d0740204a2b69ab045bde9cb166a0a57c970bc
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 }