#!/bin/bash

dt=$(date '+%Y%m%d-%H%M')
mkdir ${dt}

# <option value='https://icpc-qual-13.contest.scrool.se/standings/?filter=3' >Baylor University</option>
# grep 'option value'  baylor-dt.html | awk -F"'" '{print $2$3}' | sed 's/>/|/' | sed 's/</|/' | while read line
uri='https://icpc-qual-13.contest.scrool.se/standings/?filter='
grep 'option value'  baylor-dt.html | while read line
 do
    num=$(echo $line | awk -F'=' '{print $3}' | awk -F"'" '{print $1}')
    name=$(echo ${line} | awk -F'>' '{print $2}' | awk -F'<' '{print $1}' | sed 's/ /_/g')

    # echo "wget \"${uri}${num}\" -O ${dt}/${name}.html" 
    wget "${uri}${num}" -O ${dt}/${name}.html 
 done
