OT: getting the temp.

Jean-Pierre A. Radley appl at jpr.com
Tue Apr 16 13:39:20 PDT 2013


Henry Arredondo propounded (on Tue, Apr 16, 2013 at 01:00:17PM -0600):
| 
| 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?
| 


DOW=`date +%a`; sed -n '/day=.'$DOW'/s/.*\(low.*\)text.*/\1/p' tempx

This produces today's values:
low="71" high="87"
-- 

JP


More information about the Filepro-list mailing list