#!/bin/bash
###################################################################################
# /usr/local/bin/get-forecast
# rm20060323
# This script is tailor made for my local weather forecast, but it may work for you. 
# You should at least be able get the idea behind what it does and you can modify to 
# suit your own needs.
#
# The script uses the console web browser lynx to get my weather from the Bureau
# of Meteorology, sed to filter out the relevant lines of text amd more to display
# as output. I could probably use gmessage to display output as a pop up window but  
# this script is CLI anyway and everyone here can use/read from a console.
#
# I live on the Mornington Peninsula (AU) and my local weather forcast can be found
# at www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV17102.txt starting with a line that
# begins with "Mornington". This is the last entry on the page so I want everything 
# between "Mornington" and the first characters in the next section of that page 
# which are "[27]" or as regular expressions /Mornington/ and /\[27\]/
###################################################################################

 # Clear the console so we can concentrate on the important stuff ;^)
 clear

 echo ""

 # Provide date, time, etc. but use echo so we don't return to a prompt	
 echo -e "`date`\n"

 # Pipe webpage from lynx to grep and get the date/time issued

 lynx -dump www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV17102.txt | grep Issued

 # Make some space

 echo ""

 # Pipe webpage from lynx to sed
 # Use sed to get everything after Mornington and pipe it to sed which removes
 # everything after [26] and pipes what's left to more.
 # More is used to display text in the terminal.

 lynx -dump www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV17102.txt | \
 sed -n '/Mornington/,/\[27\]/ p' | sed -e '/\[27\]/ d' | more

 # Uncomment the following line if you have  BSD-games pom installed
 # and you want to include the current phase of the moon.
 echo -e "`pom` \n\n"

 #End of script
	



 
