Discussion Locked

Unix Script

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need to create a script shell to select some information from a XML source file.
-


-
first last
company
addr1
addr22222
addr3333
Brisbane
000
AU
12345
123
12345
email@rr.com
-

-
brazil1
-

-
Johnathan Seagull
Sheraton Australia
207 Golden Lawn Terrace
Brisbane
4000
QL
Queensland
AU
(61)(8) 9224 7777
45232
(61)(8) 9224 7788
sheraton@au.com

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)(8) 9224 7777
45232
(61)(8) 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

2 replies

by martin simons

Then do the following as the very first action:

sed -e '/

/,/
/d'

with this you no longer have the "Section 3" header, but the entire Section 2 is deleted.

This discussion is closed to new replies.