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
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Unix Script (Very URGENT)
This is the XML source file:
<?xml version="1.0" encoding="UTF-8" ?>
- <res:FormalIDNotification xmlns:res="http://www.url.com" xmlns:xsi="http://www.xxx.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.url.com FormalID_DataTypes.xsd">
- <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>
</AddressInfo>
- <OtherInfo>
<SiteID>I7560</SiteID>
</OtherInfo>
</Importer>
- <Section 2>
- <AddressInfo>
<ContactName>brazil1</ContactName>
<CompanyName>ggh</CompanyName>
<AddressLine1>rrtrt</AddressLine1>
<City>sape</City>
<PostalCode>58340</PostalCode>
<CountryCode>BR</CountryCode>
<PhoneNumber>67778879</PhoneNumber>
<Email>gghj@yyy.com</Email>
</AddressInfo>
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