#! /bin/csh -f # Last edited on 2004-08-20 22:21:43 by stolfi set usage = "$0 INFILE.data QUIZ LABEL > IMAGEFILE.png" # Plots an histogram of grades for quiz number QUIZ. # Assumes that the input INFILE.data has one record per student, # containing the student's RA number followed by the grades for # each quiz. if ( $#argv != 3 ) then echo "usage: ${usage}"; exit 1 endif set infile = "$1"; shift; set qz = "$1"; shift; set lab = "$1"; shift; set tmpfile = "/tmp/$$.hdat" cat ${infile} \ | gawk -v qz="${qz}" \ ' BEGIN { \ split("", h); split("", c); \ n = 10; s = 100.0/n; \ } \ /./{ \ g = $(qz+1); if (g == "---") { next; } \ i = int(g/s); \ h[(i < 0 ? 0 : (i >= n ? n-1 : i))]++; \ } \ END { \ for (i=0; i ${tmpfile} gnuplot <