Changes

Jump to: navigation, search

T1042 CLI Script

835 bytes added, 22:20, 13 May 2015
Created page with 'This is a bash script to display the t1042 bookings for a given day: #!/bin/bash # # Script to display today's bookings in T1042 # # CTyler 2015-05-13 # echo "T1042 sch…'
This is a bash script to display the t1042 bookings for a given day:

#!/bin/bash
#
# Script to display today's bookings in T1042
#
# 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 next friday
t1042 may 15
t1042 2016-02-01
t1042 june 7, 2018

The data displayed is taken from the [[Meeting Room T1042]] page -- and it must be formatted correctly (YYYY-MM-DD HH:MM-HH:MM) to display correctly.

Navigation menu