Read a xml file to get some information from it - TechRepublic
General discussion
July 6, 2006 at 05:01 PM
avazquez65

Read a xml file to get some information from it

by avazquez65 . Updated 19 years, 11 months ago

have a xml file with the following format:

first
last
companyaddr1addr22222addr3333Brisbane000AU< PhoneNumber>1234512312
345
email@au.com
I7560
brazil1gghrrtrt
sape
58340BR67778879gghj@jjk.com
< CnpjCpfId>25211178890CPF
testggh (This is line 5, it is even largest )

Requiriment:

I need to get is the following information: first last from the first label , and test from third label , company from the first label , and ggh from the third label and so on other information.

Problem:

I created a unix script file to read it using grep as follow:

grep filename.xml | cut -d\> -f2|cut -d\< -f1 and the result is the whole line in Line 5 described previously. How can I filter just to get the information I need from the file!?!?. I will really appreciate your help to solve this problem. Thank You!

This discussion is locked

All Comments