Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jynxxander

macrumors member
Original poster
Sep 7, 2008
30
0
I'm using Lynx to display the temperature in Geektool, but for some reason "inthe" is added to it.

I'm using the code:
Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=44221|awk '/Temperature /{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'

and this one causes the same thing,

Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=44221|awk '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'

3311715025_43d750c187_o.jpg
 
My regexp abilities are rather pathetic, but here's a messy hack using grep:

Code:
curl -s http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=44221 | grep -A 2 Temperature | grep nbsp | awk '{print substr($0, 6, length-22)}'

Thanks for the opportunity to read up on awk, by the way. Figuring this one out gave me an excuse to familiarize myself a bit with the command.
 
My regexp abilities are rather pathetic, but here's a messy hack using grep:

Code:
curl -s http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=44221 | grep -A 2 Temperature | grep nbsp | awk '{print substr($0, 6, length-22)}'

Thanks for the opportunity to read up on awk, by the way. Figuring this one out gave me an excuse to familiarize myself a bit with the command.

Thanks, but it's missing the degrees Fahrenheit that looks so good. Know anyway to add that?
 
Code:
curl -s http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=44221 | grep -A 2 Temperature | grep nbsp | awk '{print substr($0, 6, length-22) "ºF"};'
 
Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=44221 | grep -m 1 Temperature | awk '{print substr($0, 44, length-43)}'

Better?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.