Skip to content

Instantly share code, notes, and snippets.

@thumphries
Created August 2, 2012 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thumphries/3235589 to your computer and use it in GitHub Desktop.
Save thumphries/3235589 to your computer and use it in GitHub Desktop.
lol
#!/bin/bash
baseu="http://www.handbook.unsw.edu.au/vbook2012/brCoursesByAtoZ.jsp?StudyLevel=Undergraduate&descr="
basep="http://www.handbook.unsw.edu.au/vbook2012/brCoursesByAtoZ.jsp?StudyLevel=Postgraduate&descr="
if [[ ! $1 =~ ^[A-Z]{4} ]] || [ $# -eq 0 ]; then
echo "Usage: ./$0 TYPE"
else
baseu+="${1:0:1}"
basep+="${1:0:1}"
wget -q -O- $baseu $basep | w3m -dump -cols 150 -T "text/html" | grep -e "^$1" | sort | uniq | \
sed -re "s/[ \t]+[0-9]+$//g;s/[ \t]{2,}/ /g"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment