#!/bin/sh # Fritz Sieker #set -x # take the SUMMARY grade file for an assignment and split it by sections # results are left in ~/public_html/private directory. The SUMMARY file # is produced by the grading scripts and contain a login/score pair on each # line. It is assumed that one or more files with names of the form: # # CS-161-001.login # # exist in the $CheckinDir directory. These files are created by the # ~/bin/makeUsers script which creates one file per section. The resulting # files are named # # XXX-001.csv # # where XXX is the assignment name(s)passed as parameter(s)s to this script # ----------------------------------------------------------------------------- splitOneAssignment() { assignName=$1 echo "Splitting: $assignName" gradesDir=~/public_html/private/gradesDir summaryFile=$gradesDir/grades.$assignName for loginFile in `ls $CheckinDir/*.login` do bName=`basename $loginFile .login` echo "Getting grades for: $bName" section=`echo $bName | cut -d- -f3` gradeFile=$gradesDir/${assignName}-${section}.csv touch $gradeFile FS= while read login do fgrep "${login}," $summaryFile >> $gradeFile done < $loginFile done } # ----------------------------------------------------------------------------- if [ $# -lt 1 ] then echo "Usage: splitGrades [assignmentName]*" echo echo "Ex: splitGrades PA1" exit 1 fi if [ -z "$CheckinDir" ] then CheckinDir=~/Checkin fi while [ $# -gt 0 ] do assignName=$1 splitOneAssignment $assignName shift done