#!/bin/sh wget -O weatherdata.txt "http://localhost/meteolog.cgi?mode=data" tempval=`gawk '/th0/ {print $3 = ($3*(9/5)) + 32}' weatherdata.txt` humval=`gawk '/th0/ {print $4}' weatherdata.txt` barval=`gawk '/thb0/ {print $6 = $6*0.02953}' weatherdata.txt` wspdval=`gawk '/wind0/ {print $4 = $4*2.2369362920544}' weatherdata.txt` wdirval=`gawk '/wind0/ { dir="N";if($3>348.75)dir="N";else if($3>226.25)dir="NNW";else if($3>303.75)dir="NW";else if($3>258.75)dir="W";else if($3>236.25)dir="WSW";else if($3>213.75)dir="SW";else if($3>191.25)dir="SSW";else if($3>168.75)dir="S";else if($3>146.24) dir="SSE";else if($3>123.75)dir="SE";else if($3>101.25)dir="ESE";else if($3>78.75)dir="E";else if($3>56.25)dir="ENE";else if($3>33.75)dir="NE";else if($3>11.25)dir="NNE";else dir="N";print dir}' weatherdata.txt` chillval=`gawk '/wind0/ {print $6 = ($6*(9/5)) + 32}' weatherdata.txt` r_tempval=`echo $tempval | awk '{printf "%.1f",$1}'` r_barval=`echo $barval | awk '{printf "%.2f",$1}'` r_wspdval=`echo $wspdval | awk '{printf "%.1f",$1}'` r_chillval=`echo $chillval | awk '{printf "%.1f",$1}'` echo -e "TEMP::$r_tempval\nHUMIDITY::$humval\nBAROM::$r_barval\nWIND_SPD::$r_wspdval\nWIND_DIR::$wdirval\nWIND_CHI::$r_chillval" > weather.txt