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 > 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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Exception Handling bertpereira Shell Programming and Scripting 5 01-14-2009 09:28 PM
Sorting a column in this scenario krishnan_6015@y Shell Programming and Scripting 1 11-27-2007 09:34 AM
Weird scenario with Awk Khoomfire UNIX for Advanced & Expert Users 4 10-29-2007 12:25 AM
Signal Handling themezzaman High Level Programming 3 07-12-2006 10:05 PM
help in handling loops borncrazy Shell Programming and Scripting 1 08-02-2004 05:24 PM

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 05-18-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by viki
Thanks for quick response.

The suggested script is able to parse the XML tag. But suggested script prints all the lines (except XML tags) present in the file.
My requirement is to extract & print only the value of XML tag from the file.

For example,
If the file contains the following

<FILE>
www.unix.com
Enhanced Mode
<TAG> Hi
</TAG>
Enhanced Mode

</FILE>

I need to print only "Hi".


TIA,
Viki
Code:
awk '/<TAG>/,/<\/TAG>/ { gsub("<[^>]+>",""); if( $0 ) print } ' filename
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 08:48 AM.


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