Hello Everyone,

We have a process where several scripts write to centralized log file. I
have to retrieve a specific set of information and display in a format.
Following is a snippet of log file

=========================
<Bunch of text lines>

Variable_name Value
1.
2.
3.
4.
.
.
.
Upto 200 lines of variables and their values
************************1 row***************

<Bunch of text files>
===============================

I have to collect the variable_name and their value block of 200 lines.
Every 15 min. this output get added in file.

I am trying to write code for this but getting lost in b/w like below

#!/usr/bin/perl -w

$infile = "/tmp/test1.log";
$outfile = "/tmp/mysqltats.out";

open (INFILE, "<$infile") || die "cannot open $infile: $!\n"; 
open (OUTFILE, ">$outfile") || die "cannot open $outfile: $!\n"; 

while ( $mystring = <INFILE> ) {

        chomp $mystring;
        if ( $mystring =~ /\*+/) { next; }
        elsif ( $mystring =~ /^Variable_name/ ) { next; }

   #Here I need to store those 200 lines in an array or something but don't
know how. 
}


close (OUTFILE);
close (INFILE);

system ("cat $outfile");


Any help will be highly appreciable.

Best Regards,


 <<Sagar, Sanjeev.vcf>> 

Attachment: Sagar, Sanjeev.vcf
Description: Binary data

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Reply via email to