Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: grep lines from log for last 10 mints

by bimleshsharma (Beadle)
on Aug 06, 2012 at 11:14 UTC ( #985670=note: print w/ replies, xml ) Need Help??


in reply to Re^3: grep lines from log for last 10 mints
in thread grep lines from log for last 10 mints

i tried to run below code by passing path of log but getting below error continuous for line "my $tm = $Fld(1)-1 . ' ' . $Fld(2)-1 . ' ' . $Fld(3)-1;"

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump; my $start = qx{date +'%b %e %T'}; my $end = qx{date -d '10 mins ago' +'%b %e %T'}; dd $start, $end; while (<>) { my @Fld = split(' ', $_, -1); my $tm = $Fld[(1)-1] . ' ' . $Fld[(2)-1] . ' ' . $Fld[(3)-1]; print $_ if $start lt $tm and $tm lt $end; }
Use of uninitialized value in concatenation (.) or string at ./test.pl line 11, <> line 144807. Use of uninitialized value in concatenation (.) or string at ./test.pl line 11, <> line 144807.


Comment on Re^4: grep lines from log for last 10 mints
Download Code
Replies are listed 'Best First'.
Re^5: grep lines from log for last 10 mints
by Anonymous Monk on Aug 07, 2012 at 09:22 UTC

    So?

    FWIW, its a warning, if you don't want warnings, turn them off

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985670]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2015-07-28 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (251 votes), past polls