#! /usr/bin/awk -f # # H.A.Trujillo, 2 Jul 2015 # # Converts the "summary class-list" page into a format useful for # comparison with an excel spreadsheet, to check for typos after # midterm and end-of-semester grade entry. # # USAGE: # - copy the "summary class list" page from Banner and paste # into a file. # # (- append similar listings for other classes, if desired.) # # - Add any students who dropped (and are thus in the spreadsheet # but not the banner list) to the correct list, as # last-name # # - filter the file through this script and, if all looks good, # print as two-column: # gradecheck < tmpfile # gradecheck < tmpfile | enscript -2 -p outfile.ps # # - insert "^L" alone on a line to signal column-breaks. BEGIN{ FS="\t" divider1 = "**************************************" divider2 = "--------------------------------------" "mktemp /tmp/gradechk.XXXXXX" | getline tmpfil writeTmp = "sort -f -k2 -t'\t' > "tmpfil print "" } /\014/ { # let "^L" insert a column-break print "\014" next } /Number/,/Email class/ { if ($1 == "Number") { print divider1 cnt = 0 next } if ($1 ~ "Email class") { close writeTmp PrintFields() close tmpfil next } print $0 | writeTmp } END{ print " To generate ps file: print1 -2 -fCourier9 -p/tmp/pm.ps" \ >>"/dev/stderr" system( "rm " tmpfil ) } function PrintFields() { while (( getline < tmpfil ) == 1 ) { sub(/SS/, "" , $7) sub(/S/, "s", $7) sub(/Enter/, "", $8) # Nr, name, midt_grd, sem_grd printf("%2s %-24s %2s %3s\n", $1, $2, $7, $8) cnt++ if (cnt == 3) { print divider2 ; cnt = 0 } } print "\n\n" } # This scriipt expects the following tab-separated fields in the input: # 1 Number # 2 Student Name # 3 ID # 4 Reg Status # 5 Level # 6 Credits # 7 Midterm Grade # 8 Final Grade # 9 Flags # # and the following lines: # # (page headings) # # Number Student Name ID ... (table headings) # : (table data) # : # Email class # # (table and page footers) #