Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Parsing tnsnames.ora
Steve,
The following Perl segment will chomp up the TNSNAMES entries following (needs at least one blank line between entries)
#!/usr/local/bin//perl
while (defined ($line = <STDIN>)) {
$line =~ s/ //g;
$line =~ s/\t//g;
if ( $line eq "\n" ) {
print $line; }
else
{ chomp($line); print ($line); }
A4DV.HDS.COM=
(DESCRIPTION=
(ADDRESS=
(COMMUNITY=TCP)
(PROTOCOL=TCP)
(HOST=USSCINSYNC02.HDS.COM)
(PORT=1421))
(CONNECT_DATA=(SID=A4DV)
(GLOBAL_NAME=A4DV.WORLD))
)
A4DV_X.HDS.COM=
(DESCRIPTION=
(ADDRESS=
(COMMUNITY=TCP)
(PROTOCOL=TCP)
(HOST=USSCINSYNC02.HDS.COM)
(PORT=1421))
(CONNECT_DATA=(SID=A4DV)
(GLOBAL_NAME=A4DV.WORLD))
)
You can then use awk -F"=" to pull out the first word which is what you want.
Btw, I am guessing that you are collating all the TNS files in preparation to move to Oracle Name Server? (or LDAP now).
Take care, Bro! We will miss you at the OOW meet tonite.
John Kanagaraj
Oracle Applications DBA
DBSoft Inc
(W): 408-970-7002
What would you see if you were allowed to look back at your life at the end of your journey in this earth?
> -----Original Message----- > From: Orr, Steve [mailto:sorr_at_rightnow.com] > Sent: Tuesday, November 12, 2002 7:10 AM > To: Multiple recipients of list ORACLE-L > Subject: Parsing tnsnames.ora > > > Anyone have a ready-made regular expression to parse out the > net8 service > name labels from tnsnames.ora? Perl is OK. What I'm looking > for is a way to > get a list of possible connections from tnsnames.ora. For > example, from the > below I just want a regular expression which returns label1 > and label2... > -------------------------------------------------------- > label1 = (description_list= > (description= > (address=(...)) > (connect_data=(...))) > (description= > (address=(...)) > (connect_data=(...))) > ) > > label2 = (description_list= > (description= > (address=(...)) > (connect_data=(...))) > (description= > (address=(...)) > (connect_data=(...))) > ) > -------------------------------------------------------- > > AtDhVaAnNkCsE !!!!!!!! > > Steve Orr > Bozeman, Montana > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Orr, Steve > INET: sorr_at_rightnow.com > > Fat City Network Services -- 858-538-5051 http://www.fatcity.com > San Diego, California -- Mailing list and web hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an E-Mail message > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). >
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: John Kanagaraj INET: john.kanagaraj_at_hds.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Nov 12 2002 - 18:33:32 CST