//View Tip #384
Similar Tips
» Get your IP in one line
» Duplicate directory tree
» Check low space
» Find words in garbled text
» Random xkcd comic

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Go to [http://www.bbc.co.uk/cgi-perl/weather/search/new_search.pl] and search for your location. Copy the link to the 3 day forecast feed, for example [http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/0105.xml]. Then just put that link into the following command to get a quick command line weather forecast.

wget -q -O - http://feeds.bbc.co.uk/weather/.../XXXXX.xml | grep title | sed -e "s/<[^>]*>//g" -e "s/°//g" | egrep "^[A-Z]"

Example:
$ wget -q -O - http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/0105.xml | grep title | sed -e "s/<[^>]*>//g" -e "s/°//g" | egrep "^[A-Z]"
BBC - Weather Centre - Forecast for San Francisco, United States of America Tuesday: sunny, Max Temp: 22C (72F), Min Temp: 13C (55F) Wednesday: sunny, Max Temp: 22C (72F), Min Temp: 15C (59F) Thursday: sunny, Max Temp: 25C (77F), Min Temp: 14C (57F)




View Comments »




Comments 

Add your comment

Comments are currently disabled
Gene
Just a note: where it shows the degree sign in this command string I used the Unicode character:  &#xB0
Worked beautifully.
Posted 2008-11-30 01:03:08
posix
Gene, originally this symbol is space, so you can convert it by adding sed -r 's/&#xB0;/ /' in the end of command.
Posted 2010-03-16 16:39:24

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit