OT: weather script

Luke Davis ldavis at shellworld.net
Fri Aug 22 15:12:37 EDT 2003


Try piping the result through tr.  Use character classes to include all of
the characters you do want, or to exclude all of the ones you don't.  From
a quick readthrough of the man page, I came up with this:

tr -d '[:graph:]'

You *might* be able to use:

tr -cd '[:print:]'

however I don't think so.

Regards,

Luke




On Fri, 22 Aug 2003, Christopher Moore wrote:

> Hello,
> I improvised on Keith Wanton's idea for using lynx to retrieve the weather.
> The following script is very simple, but it gave me a chance to learn
> something about awk.  I named it wx and type
> wx <zipcode> to obtain the current weather.  It should work great with
> speakup except I need to figure out how to remove the degree symbol from
> the temp and dew point.
>
> Enjoy!
>
> ##### wx xcript below this line #####
> #!/bin/sh
> #  The following script uses lynx to retrieve the
> #  weather for the entered zipcode.
> #  A simple awk program selects the fields to be displayed.
> lynx -dump http://braille.wunderground.com/cgi-bin/findweather/getForecast?query=$1 $2|\
> awk ' \
> /Observed/ {print $1 " " $2 " " $3 " " $4}
> /Temperature/ {print $1 " " $2}
> /Humidity/ {print $1 " " $2}
> /Dew Point/ {print $1 " " $2 " " $3}
> /Wind/ {print $1 " " $2 " " $3 " " $4}'
>
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>




More information about the Speakup mailing list