Open main menu

CDOT Wiki β

T1042 CLI Script

This is a bash script to display the t1042 bookings for a given day:

#!/bin/bash
#
# Script to display bookings in T1042.
# Give a datespec on the command line, or no args for today.
#
# CTyler 2015-05-13
#

echo "T1042 schedule for $(date +%Y-%m-%d -d "$*"):"

curl http://zenit.senecac.on.ca/wiki/index.php/Meeting_Room_T1042 2>/dev/null|
egrep "</?td|</?tr"|tr -d "\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

To use this script, run it with no arguments for the current day, or specify a day:

t1042
t1042 tomorrow
t1042 yesterday
t1042 next friday
t1042 next week friday
t1042 last tuesday
t1042 may 15
t1042 2016-02-01
t1042 june 7, 2018

The data displayed is taken from the Meeting Room T1042 page on this wiki, and the date and times must be formatted correctly (YYYY-MM-DD HH:MM-HH:MM) to display.