The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com



UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
make multiple line containing a pattern into single line VTAWKVT Shell Programming and Scripting 13 12-04-2008 06:40 PM
Korn pattern-list with a variable partchimp Shell Programming and Scripting 2 03-26-2008 02:12 PM
sed - Replace Line which contains the Pattern match with a new line kousikan Shell Programming and Scripting 2 03-24-2007 07:24 AM
List files that do not match the search pattern olapxpert IP Networking 1 04-14-2005 03:37 PM
pattern list? jelizondo1010 UNIX for Dummies Questions & Answers 1 04-20-2001 09:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-09-2008
tredev tredev is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
Need to list pattern only not containing whole line

I am searching a pattern item_id>000111111</item_id> in an XML file.
More than one occurance are there for this patter in a single line.
I have tried
awk '/item_id/,/item_id/' tpnb1.txt>abc.txt
Full lines containg pattern are coming.
I need only list of 000111111.
  #2 (permalink)  
Old 07-09-2008
spirtle spirtle is offline
Registered User
  
 

Join Date: Jun 2008
Location: Scotland
Posts: 150
A quick and dirty solution using perl:
Code:
perl -ne 'm,<asd>(.+)</asd>, and print "$1\n" ' file.xml
or sed
Code:
sed -ne 's,<asd>\(.*\)</asd>,\1,p' file.xml
But note that this won't work if the XML has more than one item_id tag on a line like
<item_id>000111111</item_id><item_id>000111111</item_id>
Then it gets tricky.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0