Changes

Jump to: navigation, search

T1042 CLI Script

573 bytes added, 09:49, 30 January 2018
no edit summary
#
# CTyler 2015-05-13, updated after wiki move 2016-08-05
# updated with -w argument (week) 2017-01-30
#
echo function show_day() { cat $TEMPFILE| egrep "</?td|</?tr"|tr -d "T1042 schedule for \012"| sed "s|</tr><tr>|</tr>\n<tr>|g"| sed -n "s|<tr><td>$(date +%Y-%m-%d -d "$*")\([0-2][0-9]:[0-5][0-9]-[0-2][0-9]:[0-5][0-9]\)</td><td>\([^<]\+\)</td>.*$| \1 \2|p"| sort }
TEMPFILE=$(mktemp) curl https://wiki.cdot.senecacollege.ca/wiki/Meeting_Room_T1042 2>/dev/null|>$TEMPFILE echo egrep if [ "$1"</?td|</?tr== "|tr -d w"\012"|] sed "s|</tr><tr>|</tr>\n<tr>|g"|then shift sed -n echo "s|<tr><td>T1042 schedule for the week of $(date -d "$*" +%Y-%m-%d ):" for X in {0..6} do echo date -d "$*") \([0( X -2][0-9]$(date +%w) )) day" +" %A:[0" show_day "$(date -5][0d "$(date -9]d "$*") + $(( X -[0$(date +%w) )) day")" done else echo "T1042 schedule for $(date +%Y-2][0%m-9]:[0%d -5][0-9]\d "$*")</td><td>\([^<]\+\)</td>.*:" show_day "$| @" fi echo \1 \2|p"| sortrm $TEMPFILE 
To use this script, run it with no arguments for the current day, or specify a day:

Navigation menu