#!/bin/ash
cd /tmp
rm -f /tmp/forecast1.txt /tmp/forecast2.txt /tmp/forecast.txt
rm -f /tmp/wx-new.txt /tmp/wx.txt /tmp/hourly.html
rm -f /tmp/zone1.txt /tmp/zone2.txt /tmp/zone.html
wget -q http://iwin.nws.noaa.gov/iwin/al/hourly.html
wxtime=`grep -m 1 "00 [AP]M" hourly.html | sed "s/00 //g" | awk '{print $1 " WEATHER " }'`
wx1=`grep -m 1 "SHELBY CO ARPT" /tmp/hourly.html | cut -b 16- | cut -b 1-7`
wx2=`grep -m 1 "SHELBY CO ARPT" /tmp/hourly.html | cut -b 25- | cut -b 1-3`
echo -n $wxtime"<FI>$wx1/${wx2}F" >/tmp/wx-new.txt
(grep -m 1 AVBL /tmp/wx-new.txt >/dev/null) && echo "CURRENT<FI>WEATHER IS<FI>UNAVAILABLE" >/tmp/wx-new.txt
mv /tmp/wx-new.txt /tmp/wx.txt
wget -q http://iwin.nws.noaa.gov/iwin/al/zone.html
##~/prolite/monitor/wxparse >/tmp/forecast-new.txt
##mv /tmp/forecast-new.txt /tmp/forecast.txt
sed "1,/ALABASTER/d" /tmp/zone.html > /tmp/zone1.txt
sed -e "/ NIGHT/,/goodbye/d" /tmp/zone1.txt > /tmp/zone2.txt
tr "\n" " " < /tmp/zone2.txt > /tmp/forecast1.txt
sed "s/.*SHELBY/SHELBY/g" /tmp/forecast1.txt > /tmp/forecast2.txt
sed "s/^/SHELBY COUNTY AIRPORT\.\.\. /" /tmp/forecast2.txt > /tmp/forecast.txt


