Friday, January 06, 2006

posted by skynare at 10:19 PM

"Queens College Report" has

I needed an unofficial transcript from my college ( Queens College - CUNY ).
So, I went to the registrar's office to get a copy.
But they only provided printed copy of transcript.
I mean, no file? Come on!
Anyways, I needed a transcript with course numbers and course titles.
But webregs.qc.edu (the site where students can look up their grades and stuff) was written in stupid ASP and probably running on Windows 95. And it doesn't give me course titles.
I mean, come on! Why? Why? Why?

So, I wrote a script to insert course titles based on course codes.
Two files are needed as an input:
#1. a list of course codes i took.
#2. a list of course code => course title hash table.

I can get #1. from webregs.qc.edu by copy and pasting my record.
I got #2 from other site that has course schedules. (you can view source on the site and find javascript array).

So, here's the script:

#!/bin/bash
transcript=$1
courselisting=$2

if [[ -z $transcript || -z $courselisting ]]
then
echo "usage : $0 transcript.txt courselisting.txt"
exit 1
fi

courses="grep \"[[:upper:]]\{3,\}[[:space:]]\{1,\}[[:digit:]]\{3,3\}\" ${transcript}"
tempfile="${transcript}.temp.txt"
eval $courses > $tempfile

while read department number credits grade
do
echo $department $number
grep "${department}[[:space:]]\{1,\}${number}" ${courselisting} |sed 's/^\".. //'
echo "grade: ${grade}"
echo "------------------"
done < "$tempfile"

rm $tempfile

0 Comments:

Post a Comment

« Home