[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SLUG] Extracting Weather text out of a web page - Newbie Question
A number of good suggestions so far but here's another one
#!/bin/bash
wget http://www.weather.com/weather/cities/as__sydney.html
BLURB=`lynx -dump as__sydney.html | grep -A 15 CURRENTLY`
WIND=`echo "$BLURB" | grep Wind | awk -F: '{print $2}'`
echo $WIND
For me this produced:-
From the Southeast at 12 mph
But you might have better luck parsing the output of pages at
http://www.bom.gov.au (Bereau of Meteorology) as they seem to reliably
use the <pre> tags for the good bits :-)
Of course the _elegant_ solution would be to find a site that spits it
out in XML. For the layman it's like HTML (HTML can be written as an
XML compliant document).
> Date: Sat, 1 Jul 2000 13:17:13 +1000
> From: "Grahame M. Kelly" <grahame@nospam.wildpossum.com>
> Subject: [SLUG] Extracting Weather text out of a web page - Newbie Question
>
> Yes, I'll admit to being a html/web newbie.
>
> So, for a thick head on this side of the email, how does one extrace the
> temperature, due point, humidity textural information etc. from a page like
>
> http://www.weather.com/weather/cities/as__sydney.html
>
> Does anyone have a simpler more elegant solution ?
---<GRiP>---
Grant Parnell gripz@nospam.linuxfreak.com (gparnell@nospam.bigpond.net.au)
Ph: 02-8701-4564 Mob: 0408-686-201 Web: http://linuxfreak.com/~gripz
No Microsoft products were used in the production of this message.
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text