E
E
EIvizz2015-07-10 16:12:29
XML
EIvizz, 2015-07-10 16:12:29

How to parse xml response yandex weather?

There is a file from which it is necessary to tear out the temperature and type of weather on a certain day.
Using xmlstarlet : xmlstarlet sel -t -v "//*[name()='weather_type']" pogoda.xml displays all weather_type values ​​that are in the file and would like within /forecast/day%date%/day_part%? %

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EIvizz, 2015-07-14
@EIvizz

first remove the xmlns
cat pogoda.xml part | sed 's/\(forecast\)\(.*\)/\1\3/' > 1xml
a="2"
b="4"
xmlstarlet sel -t -v //forecast/day[$a]/ day_part[$b]/weather_type -n 1.xml

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question