Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by aitap (Deacon)
on Aug 07, 2012 at 09:42 UTC ( #985927=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -n
    # note the -n switch
    ...
    use features 'say';
    BEGIN{$main::now=time;$main::old=(time-60*10)}
    if(/^(\w+\s+\d+\s+\d+:\d+:\d+)/) {$t=str2time $1; $t > $old && $t < $n
    +ow && print}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985927]
help
Chatterbox?
[choroba]: I loved McVitie's, but stopped buying them when they started using palm oil
[1nickt]: ++choroba for walking the walk
[choroba]: My children don't want to eat "dead monkey" biscuits

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2017-11-20 13:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (286 votes). Check out past polls.

    Notices?