E
E
Egor Ivanov2020-09-24 10:03:03
Parsing
Egor Ivanov, 2020-09-24 10:03:03

How to structure the output when parsing xml?

I just started to understand this issue, so do not judge strictly
Ubuntu
There are a huge number of extracts from the USRN in xml format, you need to extract certain data from all these files, for example, I took the CadastralNumber header. I found a solution using the xmlstarlet utility and wrote the following script:

#1 /bin/bash
sudo xmlstarlet
for f in ./*.xml; do  xmlstarlet sel -t -v "//*[name()='CadastralNumber']" *.xml > result.txt
done


As a result, I get a file with the output from the cadastral numbers in one line and without spaces, thereby parsing the result, although it is possible, but despite the fact that there are more than five thousand xml files, it will take a huge amount of time. Now the question is, if it is possible to somehow structure all these cadastral numbers into a readable form with subsequent export to excel? I didn't find the answer, so I'm asking for the help of experts

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question