The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading and searching xml element text in script forevercalz Shell Programming and Scripting 2 11-24-2005 06:36 PM
reading and searching xml element text in script forevercalz Shell Programming and Scripting 6 11-10-2005 08:35 PM
searching searching tony3101 Shell Programming and Scripting 3 06-04-2004 08:50 AM
searching for { yotoruja Shell Programming and Scripting 4 11-03-2003 07:07 AM
Shell Script for searching files with date as filter kanakaraj_s Shell Programming and Scripting 3 05-14-2002 08:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 1
Red face Searching XML tag in a script

Hey,

I need to parse the following XML to just grab the Customer ID.
Is there any RegEx that can achieve this ?

So in this example, the script just return 0000109654, as the output.
Even if it involves awk, sed please let me know.

************
<?xml version="1.0" encoding="UTF-8"?>
<ns0:CustomerUpdate xmlns:ns0="http://www.hmco.com/schemas/sfa/customer_update"
FileName="" CustomerUpdateDateTime="2006-05-24T23:02:47.366-04:00" Count="1"><ns0:Customer CustomerID="0000109654" CustomerName="BETHEL PUBLIC SCHOOLS" Status="
A" ClassCode="G" ClassName="Governing Organiz." <ns0:Address AddressLine1="220 175TH ST S
" AddressLine2="LEARNING ASESSMENT BULDING" AddressLine3="" City="SPANAWAY" State="WA" ZipCode="98387-8703" CountyName="PIERCE" CountryCode="US" CountryName="US
A"/></ns0:Customer></ns0:CustomerUpdate>
************

Thanks in advance,
Arun.
Reply With Quote
Forum Sponsor
  #2  
Old 05-24-2006
Registered User
 

Join Date: Dec 2005
Location: London
Posts: 222
sed '/CustomerID/!d;s/.*CustomerID="\([0-9]*\)" Customer.*/\1/g;' filename
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0