Filter output in curl

Hello guys,

I'm writing a little script which sends me sms with my shell script via api of a sms provider.

problem is I can't filter my curl output for this site:

site url:

http://fahrplan.oebb.at/bin/query.exe/dn?start=1&_charset=UTF-8&REQ0JourneyProduct_list=0:1111111111011000-000000.&SALL=1&ZALL=1&scotty_advancedSearchMode=0&S=mureck&Z=graz%20puntigam&REQ0JourneyDate=21.08.2014&time=04:00&timeSel=depart

this is what i got so far, but I don't know how to filter everything out, I just want the times and also only the "ab time" like

#!/bin/bash
URL='http://fahrplan.oebb.at/bin/query.exe/dn?start=1&_charset=UTF-8&REQ0JourneyProduct_list=0:1111111111011000-000000.&SALL=1&ZALL=1&scotty_advancedSearchMode=0&S=mureck&Z=graz%20puntigam&REQ0JourneyDate=21.08.2014&time=04:00&timeSel=depart'

echo "Now:" `date +%H:%M:%S`
for URL in $URLS; do
echo "$URL:" | sed 's/.*=.*=/Route /'
curl -s $URL \

done

cheers

Once again I haul out my micro xml parser for these questions... It looks like you want the contents of the very first <div class="planed">...</div> block.

$ cat planed.xml

BEGIN {
        FS=">"
        RS="<"
}

NR==1 { next } # The first "line" is blank when RS=<
/^[!?]/ {       next    }               # Skip XML specification junk
{       gsub(/[\r\n]*$/, " ");  }       # Clean up newlines

# Handle open-tags
match($0, /^[^\/ \r\n\t>]+/) {
        TAG=substr(toupper($1), RSTART, RLENGTH);
        TAGS=TAG "%" TAGS;
}

# Handle close-tags
/^[\/]/ {
        sub(/^\//, "", $1);
        sub("^.*" toupper($1) "%", "", TAGS);
        next;
}

(TAGS ~ /^DIV%/) && ($1 ~ /planed/) {
        gsub(/[\r\n]/, "", $2);
        print $2;
        exit;
}

$ awk -f planed.awk input.html

05:08 ab

$

The code highlighted in red is the statement which extracts the tag you want. The rest is generic XML parsing code.