#! /bin/bash # /home/$USER/.weather/weather > /tmp/NOAAweatherinformationscript URL='http://archerseven.com/served/.weather/broadcast' wget -qO /tmp/NOAAweatherinformationscript ${URL} #AID="${*}:" [ "${1}" ] && AID="${*}:" || AID="STL:" for each in `echo "${AID}"`; do each=`echo ${each} | tr 'a-z' 'A-Z'` #echo $each if [ ! "$(grep "${each}" /tmp/NOAAweatherinformationscript)" ]; then echo "Location not found" continue fi CITY=`awk "/${each}/ "'{print substr($0,34,15)}' /tmp/NOAAweatherinformationscript | sed -e 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g' -e 's/*//'` CONDITIONS=`awk "/${each}/ "'{print substr($0,49,9)}' /tmp/NOAAweatherinformationscript | sed -e 's/LGT/Light /' -e 's/HVY/Heavy /' -e 's/PT/Partly /' -e 's/MO/Mostly /' -e 's/CLDY/Cloudy/' -e 's/FRZ/Freezing/' -e 's/TSTM/Thunderstorm/' -e 's/BLWG/Blowing /' -e 's/DRZL/Drizzle/' | sed -e 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g'` TMP=`awk "/${each}/ "'{print substr($0,58,3)}' /tmp/NOAAweatherinformationscript` DP=`awk "/${each}/ "'{print substr($0,62,3)}' /tmp/NOAAweatherinformationscript` RH=`awk "/${each}/ "'{print substr($0,66,3)}' /tmp/NOAAweatherinformationscript` WS="`awk "/${each}/ "'{print substr($0,70,6)}' /tmp/NOAAweatherinformationscript | sed -e 's/N/North /' -e 's/S/South /' -e 's/E/East /' -e 's/W/West /' -e 's/G/ Gusting to /' -e 's/CALM/Calm/'`" HG=`awk "/${each}/ "'{print substr($0,80,6)}' /tmp/NOAAweatherinformationscript | sed -e 's/S/ Inches of mercury and holding/' -e 's/F/ Inches of mercury and falling/' -e 's/R/ Inches of mercury and rising/'` REM=`awk "/${each}/ "'{print substr($0,86)}' /tmp/NOAAweatherinformationscript | sed -e 's/WCI/Wind Chill/' -e 's/VSB/Visibility/' -e 's/HI/Heat Index/'` HR="`awk "/${each}/ "'{print substr($0,6,27)}' /tmp/NOAAweatherinformationscript | sed -e 's/00 /:00 /'`" echo "Location: ${CITY}" echo "Conditions: ${CONDITIONS}" echo "Temperature: ${TMP} Degrees Farenheit" echo "Dew Point: ${DP} Degrees Farenheit" echo "Relative Humidity: ${RH}%" echo "Wind (in MPH): ${WS}" echo "Barromic Pressure: ${HG}" echo "Notes/Remarks: ${REM}" echo "Updated: ${HR}" done ##optional #rm -f /tmp/weather #rm -f /tmp/NOAAweatherinformationscript #rm -f /tmp/weather.*