I second the xmlstarlet approach, why bother creating one's own (crude) parser when xml parsers already exist. -Eldo
On 7/17/25 1:57 AM, Russell Senior wrote: > Here's what I came up with: > > curl -s https://forecast.weather.gov/xml/current_obs/KEUG.xml | sed > 's/\(<\/[^!>]\+>\)/\1\n/g' | grep temp_f | cut -d\> -f2 | cut -d\< -f1 > > the sed adds a newline to any close-tags </foo>, grep picks the line, > and the cuts get rid of the wrapping tags. > > Or, since xml parsing utilities exist: > > sudo apt install xmlstarlet > > then: > > curl -s https://forecast.weather.gov/xml/current_obs/KEUG.xml | > xmlstarlet sel -t -v "//temp_f" - > > or maybe even: > > echo $(curl -s https://forecast.weather.gov/xml/current_obs/KEUG.xml > | xmlstarlet sel -t -v "//temp_f" -) >