#!/bin/bash
file1="spring2011-20101105.html"
file2="spring2011output.txt"
file3="spring2011output2.txt"
cat $file1 | egrep '^(
.*$|Credits)' \
| sed 's/^.*crn_in=[0-9]\{5\}">\(.*\) - \([0-9]\{5\}\) - \([A-Z]\{3,4\} [0-9]\{4\}\) - \([0-9]\{3\}\)<\/A.*$/\2:\3-\4:\1/g' \
| sed 's/^ | \(.*\)<\/TD>$/\1/g' | sed 's/( $file2
cat -n $file2 | sed 's/^ *//g' | sed 's/\t/,/' | sed 's/ /*/g' \
| grep '^[0-9][0-9]*,[0-9]{5}' | sed 's/,/:/' > $file3
filecontent=( `cat $file3 `)
for t in "${filecontent[@]}"; do
line=$(echo $t | cut -d":" -f1)
crn=$(echo $t | cut -d":" -f2)
classcode=$(echo $t | cut -d":" -f3)
description=$(echo $t | cut -d":" -f4)
echo -e "$crn\n$classcode\n$description" > "classlists/$crn.txt"
done
echo "Enter a CRN to look up."
read crnlookup
clear
cat classlists/$crnlookup.txt | sed 's/*/ /g'
answer=true
while ($answer -eq true); do
echo ""
echo "Do you want to look up another CRN y/n?"
read answers
clear
if [ $answers = 'y' ]; then
answer=true
echo "Enter a CRN to look up."
read crnlookup
cat classlists/$crnlookup.txt
else
answer=false
fi
done
exit 0