OT: getting the temp.

Kenneth Brody kenbrody at spamcop.net
Tue Apr 16 12:48:18 PDT 2013


On 4/16/2013 3:00 PM, Henry Arredondo wrote:
>
> Hi, Has anyone tried to get current or daily range temperature using Unix/Linux command line ? I'm using wget but I was wondering if there's an easier way to do this.
>
> Here's what I'm doing :
>
>          wget -O tempx http://weather.yahooapis.com/forecastrss?p=75050                          {get temp for zip code 75050}
>
>          then I do a
>
>          grep yweather:forecast tempx | head -n 1
>
>          and now I'm stuck on how to parse the word low and high from this line into a $String :
>
>                  <yweather:forecast day="Tue" date="16 Apr 2013" low="71" high="87" text="Partly Cloudy" code="30" />
>
>
>          LOW=' grep yweather:forecast tempx | head -n 1 | search "low" bring "71"`
>          HIGH=' grep yweather:forecast tempx | head -n 1 | search "high" bring "87"`     <-- kinda deal ?
>
> Any ideas?

Try this:

==========
eval `grep "yweather:forecast" tempx | head -1 |
     sed "s:^.*forecast ::
     s:/>::"`

echo $low
echo $high
==========

-- 
Kenneth Brody


More information about the Filepro-list mailing list