On Wed, Jul 16, 2025 at 9:57 PM Michael Barnes <barnmich...@gmail.com> wrote: > > I have a script that is supposed to grab a weather feed and return the > current temperature. If grabs the file fine, but does not return the > temperature. > > Here is the line that fails: > > T=$(grep "<temp_f>" KEUG.xml |cut -c10- |cut -d '.' -f 1)
Out of curiosity, why are you truncating the fractional part? <pet-peeve> Also, there is a special place in hell for whoever didn't include an easily handled timestamp format (like unix time, seconds since 1970-01-01 in UTC, or similar) in that XML. Even: <observation_time_rfc822>Thu, 17 Jul 2025 00:53:00 -0700</observation_time_rfc822> is obnoxious, although tools exist, e.g. $ date -d "$(curl -s https://forecast.weather.gov/xml/current_obs/KPDX.xml | xmlstarlet sel -t -v "//observation_time_rfc822" -)" +%s 1752785580 Hey, NWS person! You had a nice representation in your computer, and now you are just being cruel to anyone who wants to do anything useful with your machine readable turd! /me shakes angry fist at cloud. </pet-peeve> -- Russell Senior russ...@personaltelco.net