Typically I'm against just doing something for somebody, but you caught me
at a good time.
Here is an example to get you started:
#!/usr/local/bin/perl -w
use strict;
my $input = shift;
my $total;
die "Usage: Arg1: Input File to Scan."
unless $input;
open IN, "< $input" or die "Unable to open $input for reading, $!, stopped";
while ( defined(<IN>) ) {
while ( <IN> ) {
if ( /Total:/ ) { last };
}
while ( <IN> ) {
if ( /^\s*\d+/ ) {
chomp;
s/\s*(\d+)\s*/$1/;
$total = $_;
printf "Total: %010s", $total;
}
}
}
close IN;
-----Original Message-----
From: danield [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2003 9:49 PM
To: [EMAIL PROTECTED]
Subject: Reading from log
Hello all,
I am looking for help with creating a digest of a log file. I have found
a nice tutorial that should help on
http://www.pageresource.com/cgirec/ptut14.htm. However, this tutorial
expects to have values in list separated by | :
he Rock|Cheer|Rock Bottom
Triple H|Boo|Pedigree
Stone Cold|Cheer|Stone Cold Stunner
And I do have a log file, that looks like:
...
Format count
a 100
b 51
c 130
d 5
e 6
Total: ---
292
...
And I need to go through that log and find that 292 and store it into
variable.
If it was something like 'total: 292', I might be able to do it, however the
value
is on completely new line and nothing precedes it.
Is anyone willing to help me?
I am a completely newbie in programming.
Thank you for your time.
danield
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>