Hello Fellow Perlites,
I'm having difficulty parsing a file and could use some help here.
I've attached my code, output file, and sample job run.
Basically, I want to read an Oracle TNS file (tnsnames.ora) and list
the host name and service on that server based on this input file. A
sample TNS
Greetings,
This is the multi line pattern in which I wish to match:
tr
tdb String 1.2.3.4.5.6 /b/td
tdimg src=pics/green.gif alt=OK/td
tr
This is what I have:
==
#!/usr/bin/perl -w
my $file='./index.html';
open INFILE, $file or die
Am Dienstag, 8. März 2005 17.20 schrieb William Melanson:
Greetings,
Greetings too :-)
This is the multi line pattern in which I wish to match:
tr
tdb String 1.2.3.4.5.6 /b/td
tdimg src=pics/green.gif alt=OK/td
tr
This is what I have:
This is the multi line pattern in which I wish to match:
tr
tdb String 1.2.3.4.5.6 /b/td
tdimg src=pics/green.gif alt=OK/td
tr
One way to solve this would be to read lines from the file and save
chunks of N lines (4 in this case) in a temp variable. Then your regex
would operate on enough
On Tue, 8 Mar 2005 13:42:44 -0500, Dave Gray [EMAIL PROTECTED] wrote:
This is the multi line pattern in which I wish to match:
tr
tdb String 1.2.3.4.5.6 /b/td
tdimg src=pics/green.gif alt=OK/td
tr
One way to solve this would be to read lines from the file and save
chunks of N lines
Something like (untested):
my (@lines, $num) = ((), 4);
while (INPUT) {
push @lines, $_;
shift @lines if @lines == $num+1;
print 'lines '.($.-$num+1).' to '.($.). match\n
if join('',@lines) =~ /regex goes here/;
}
That assumes that the pattern being searched for
Dave Gray wrote:
This is the multi line pattern in which I wish to match:
tr
tdb String 1.2.3.4.5.6 /b/td
tdimg src=pics/green.gif alt=OK/td
tr
One way to solve this would be to read lines from the file and save
chunks of N lines (4 in this case) in a temp variable. Then your regex
would operate
On Tue, 8 Mar 2005 15:26:28 -0500, Dave Gray [EMAIL PROTECTED] wrote:
Something like (untested):
my (@lines, $num) = ((), 4);
while (INPUT) {
push @lines, $_;
shift @lines if @lines == $num+1;
print 'lines '.($.-$num+1).' to '.($.). match\n
if join('',@lines) =~
my (@lines, $num) = ((), 4);
You are assigning the list ((), 4) to @lines and nothing to $num. Perhaps you
meant:
my ( $num, @lines ) = ( 4, () );
Or simply:
my ( $num, @lines ) = 4;
Indeed, good catch.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,