Hello Tom, Thank you very much. I appreciate your help. This script works flawlessly, and does exactly what I need.
Thank you for your time. danield >From: "Tom Kinzer" <[EMAIL PROTECTED]> >To: "Beginners Perl" <[EMAIL PROTECTED]> >Subject: RE: Reading a log file, again >Date: Mon, 8 Dec 2003 12:32:51 -0800 > >Try this: > >Caveat: This all assumes LOTS about the format of your data being >consistent, and so should be treated as a "quick and dirty" as opposed to >anything resembling a robust application... I'm not sure what your >intention with the script is, but is worth mentioning. > >-Tom Kinzer > >__SNIP__ > >my $input = '/appl/log/200301130.txt'; >my $total; >die "Usage: Arg1: Input File to Scan." > unless $input; > >open IN, "< $input" or die "Unable to open $input for reading, $!, stopped"; > > >while ( <IN> ) { > if ( / Document Format/ ) { last }; >} > >while ( <IN> ) { > if ( / Total: -------------/ ) { last }; >} > >while ( <IN> ) { > if ( /^\s*\d+/ ) { > chomp; > s/\s*(\d+)\s*/$1/; > $total = $_; > printf "Total: %010s\n", $total; > last; > } >} > >close IN; > >__END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>