Discussion Locked

Unix Script (Very URGENT)

0 helpful
3 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, and I do not how to do it!!>

This is the XML source file:


-
-

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

-
I7560


-

-
brazil1
ggh
rrtrt
sape
58340
BR
67778879
gghj@yyy.com

I need to select just part of the information, Example:

From the section 1, I need to get first last from label ContactName and company from the label CompanyName or can be anyone from the section 1.

Same case for the section 2

Thank you for your help

Best Regards

Aurelio Vazquez Alejo
avazquez65@yahoo.com

3 replies

by cpfeiffe

Many ways. You can use awk, sed with regular expressions, perl, etc. I think cut will be the simplest if you don't have a lot of shell scripting experience. Here is a sample:
grep ContactName xmlfilename |cut -d\> -f2 |cut -d\< -f1

The result will be 'first last'.

by avazquez65

I have oe more comment!!

I have two , the first one in the first section 1 and the second in section 2.

How can I get them separetly.

Thann you for your help

Best Regards

This discussion is closed to new replies.