General discussion

Locked

Unix Script

By avazquez65 ·
I need to create a script shell to select some information from a XML source file.
- <Section 1>
- <AddressInfo>
<ContactName>first last</ContactName>
<CompanyName>company</CompanyName>
<AddressLine1>addr1</AddressLine1>
<AddressLine2>addr22222</AddressLine2>
<AddressLine3>addr3333</AddressLine3>
<City>Brisbane</City>
<PostalCode>000</PostalCode>
<CountryCode>AU</CountryCode>
<PhoneNumber>12345</PhoneNumber>
<PhoneExtension>123</PhoneExtension>
<FaxNumber>12345</FaxNumber>
<Email>email@rr.com</Email>
- <Section 2>
- <AddressInfo>
<ContactName>brazil1</ContactName>
- <Section 3>
- <AddressInfo>
<ContactName>Johnathan Seagull</ContactName>
<CompanyName>Sheraton Australia</CompanyName>
<AddressLine1>207 Golden Lawn Terrace</AddressLine1>
<City>Brisbane</City>
<PostalCode>4000</PostalCode>
<DivisionCode>QL</DivisionCode>
<DivisionName>Queensland</DivisionName>
<CountryCode>AU</CountryCode>
<PhoneNumber>(61)( 9224 7777</PhoneNumber>
<PhoneExtension>45232</PhoneExtension>
<FaxNumber>(61)( 9224 7788</FaxNumber>
<Email>sheraton@au.com</Email>

From section 1:
I need to get the folowing texts:
first last
company
addr1
addr22222
addr3333
Brisbane
000
AU
12345
123
12345
email@rr.com

From section 3:
I need to get the folowing texts:
Johnathan Seagull
Sheraton Australia
207 Golden Lawn Terrace
Brisbane
4000
QL
Queensland
AU
(61)( 9224 7777
45232
(61)( 9224 7788
sheraton@au.com

We used grep, sed, awk, but when we got the information we get at the same time information from the section 1, section 2 and section 3, and we only need information from section 1 and section 3.

I really appreciate your help

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums