File content question
From: Sanjeev Sagar (sanjeev.sagar_at_eds.com)
Date: 03/30/04
- Next message: John W. Krahn: "Re: Search for a file pattern in a directory tree recursively"
- Previous message: ewalker_at_micron.com: "RE: hash"
- Next in thread: Morbus Iff: "Re: File content question"
- Maybe reply: Morbus Iff: "Re: File content question"
- Reply: John W. Krahn: "Re: File content question"
- Maybe reply: Sanjeev Sagar: "RE: File content question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: Mon, 29 Mar 2004 16:24:58 -0600
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>>
- application/octet-stream attachment: Sagar__Sanjeev.vcf
- Next message: John W. Krahn: "Re: Search for a file pattern in a directory tree recursively"
- Previous message: ewalker_at_micron.com: "RE: hash"
- Next in thread: Morbus Iff: "Re: File content question"
- Maybe reply: Morbus Iff: "Re: File content question"
- Reply: John W. Krahn: "Re: File content question"
- Maybe reply: Sanjeev Sagar: "RE: File content question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|