The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 3 Weeks Ago 06:12 PM
How to remove only html tags inside a file? btech_raju Linux 2 11-23-2007 09:25 AM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 07:17 PM
How to split file by tags inside file? spookyrtd99 Shell Programming and Scripting 1 07-30-2006 09:50 PM
How to search a pattern inside a zipped file ie (.gz file) with out unzipping it senraj01 Shell Programming and Scripting 2 04-26-2006 01:32 AM

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

Join Date: Sep 2006
Posts: 5
Search for xml tags in a file

Hi,

I need to search for a pattern like :

<A:UserAttr Name="ACTIVITY_ID">
<A:Value>1111120</A:Value>
</A:UserAttr>

Let us the there is a dir /tmp that contains 5 xml file. each of them multiple above tags in the file. If found all the three line would be together.

Now I have to search for that pattern and if found i am supposed to extract the value i.e 1111120 write to another file.

Is it possible to do this. If so, how?
Reply With Quote
Forum Sponsor
  #2  
Old 09-20-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
See if this helps a little:
Code:
sed -n '/A:UserAttr Name="ACTIVITY_ID"/,/A:UserAttr/p' filename
Reply With Quote
  #3  
Old 09-20-2006
Registered User
 

Join Date: Sep 2006
Posts: 5
Thanks, It works!!
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 04:35 AM.


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