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
extraction of last but one char hidnana Shell Programming and Scripting 5 02-14-2008 08:22 AM
AWK extraction harris2107 Shell Programming and Scripting 2 01-15-2008 11:44 AM
Help with tar extraction! manthasirisha Shell Programming and Scripting 4 03-17-2006 07:17 AM
extraction from a tape big123456 UNIX for Advanced & Expert Users 4 10-25-2005 04:34 AM
help on file extraction apalex UNIX for Dummies Questions & Answers 1 05-01-2001 10:29 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-16-2007
harris2107 harris2107 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 8
AWK extraction

Hi all,
Can anyone please help me in parsing the following file. Suppose the file is called, example.lst, and has the following content in it.

(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 192.168.2.2)
(Port = 1525)
)
)
(CONNECT_DATA = (SID = TESTDB1)
)
)


(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 192.168.2.4)
(Port = 1525)
)
)
(CONNECT_DATA = (SID = TESTDB2)
)
)


I want to extract only the value of all Host (i.e, 192.168.2.4, 192.168.2.2) and value of all SID (i.e., TESTDB1, TESTDB2) from this file. Depending on the number of HOST and SID present in the file, i want to assign them to arrays, like

host[1]=192.168.2.2
host[2]=192.168.2.4
sid[1]=TESTDB1
sid[2]=TESTDB2 and so on....


I am trying this script in Korn shell. I am working with AWK.

Any help would be greatly appreciated.

Thanks,
Harris
 

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 03:37 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