homer4all has asked for the wisdom of the Perl Monks concerning the following question:
Sample file (tnsfile.txt)if /^(([A-Za-z][A-Za-z0-9]*)(\.([A-Za-z][A-Za-z0-9]*))*)(\s|,|=)/ { (/\(CONNECT_DATA\s+=\s+\(SID\s+=\s+(\w+\d+?)(\s+)?\)/) { $hashref->{$1}=""; } }
Expected $hashref value:DB1.UK, DB2.UK = ( (ADDRESS = (PROTOCAL = TCP)) (CONNECT_DATA = (SID = db1)) ) DB1.EU, DB2.CH = ( (ADDRESS = (PROTOCAL = TCP)) (CONNECT_DATA = (SID = db1)) ) DB3.UK = ( (ADDRESS = (PROTOCAL = TCP)) (CONNECT_DATA = (SID = db3)) ) DB3.US = ( (ADDRESS = (PROTOCAL = TCP)) (CONNECT_DATA = (SID = db3)) ) DB5.UK.US, DB5.US = ( (ADDRESS = (PROTOCAL = TCP)) (CONNECT_DATA = (SID = db5)) )
DB1.UK DB3.UK DB5.UK.US
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl parsing file
by Eily (Monsignor) on May 30, 2014 at 16:05 UTC | |
by homer4all (Acolyte) on May 30, 2014 at 16:27 UTC | |
|
Re: Perl parsing file
by Anonymous Monk on May 30, 2014 at 15:48 UTC | |
by homer4all (Acolyte) on May 30, 2014 at 15:51 UTC | |
by choroba (Cardinal) on May 30, 2014 at 16:02 UTC | |
by homer4all (Acolyte) on May 30, 2014 at 16:06 UTC |