Getting tomorrow's high temperature
Thomas Arman
tarman at me.com
Sat Aug 1 17:11:49 EDT 2015
Well, As you can tell I like the quick and dirty solutions.
The “proper way” to do this would be to use a real json parsing tool.
Even easer “proper solution” would be to use the XML form of the URL vs the JSON one and
write some simple stylesheet.xsl and use a command-line XSLT processor such as xsltproc <http://xmlsoft.org/XSLT/xsltproc2.html>, saxon <http://saxon.sourceforge.net/> or xalan <http://xalan.apache.org/> to parse the XML.
Tom
P.S.: that is a bogus key.
> On Aug 1, 2015, at 4:51 PM, Thomas Arman <tarman at me.com> wrote:
>
> Here is command that just provides the digits of the temp:
>
> curl http://api.wunderground.com/api/0516fe43ba763806/forecast/q/NC/Raleigh.json <http://api.wunderground.com/api/0516fe43ba763806/forecast/q/NC/Raleigh.json> 2>/dev/null | grep \"fahrenheit\": | sed -n 3p | sed s/.\*\"fahrenheit\":\"// | sed s/\",//
>
> 94
>
> The “3p” selects the third temperature from the response where 1st and 2nd are “DAY 1 high and low” and 3rd and 4th are “DAY 2 high and low”.
>
> Tom
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shed.com/pipermail/xtensionlist/attachments/20150801/95ab511b/attachment.html>
More information about the XTensionList
mailing list