summaryrefslogtreecommitdiff
path: root/shtrains.sh
diff options
context:
space:
mode:
Diffstat (limited to 'shtrains.sh')
-rwxr-xr-xshtrains.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/shtrains.sh b/shtrains.sh
index d49738e..0d9739a 100755
--- a/shtrains.sh
+++ b/shtrains.sh
@@ -1,9 +1,20 @@
#!/bin/bash
-links -dump 'http://transilien.mobi/pam/TempReelSaisieDepartSubmit.do?debutDepart=Courbevoie&tous=Tous+trains' > trains.tmp
-#wget -q -O trains.tmp 'http://transilien.mobi/pam/TempReelSaisieDepartSubmit.do?debutDepart=Courbevoie&tous=Tous+trains'
+links -dump 'http://transilien.mobi/pam/TempReelSaisieDepartSubmit.do?debutDepart=Courbevoie&tous=Tous+trains' | head -n 22 | tail -n 18 >trains.tmp
-echo "PRIVMSG $CHANNEL2 :"$*
+cat trains.tmp | \
+while true
+do
+ read PATTERN || break
+ read STATION || break
+ read UGUU || break
+ [[ $PATTERN =~ \ *[A-Z]{4}\ *(.*) ]] && PATTERN=${BASH_REMATCH[1]}
+ if [ -n "$*" ]; then
+ [[ $STATION =~ $@ ]] && echo "$PATTERN $STATION"
+ else
+ echo "$PATTERN $STATION"
+ fi
+done
exit 0