in reply to Re^2: grep lines from log for last 10 mints
in thread grep lines from log for last 10 mints
Sorry, I couldn't understand you.
Does it just terminate without any output when you run it, or the shell tries to make you input some more text? Can you show the exact command you run (you said that you tried passing the filename as a commandline argument, which is right)? What shell are you using? Can you show a small example of file being parsed?
You can also put the whole oneliner in a file, like this:
Does it just terminate without any output when you run it, or the shell tries to make you input some more text? Can you show the exact command you run (you said that you tried passing the filename as a commandline argument, which is right)? What shell are you using? Can you show a small example of file being parsed?
You can also put the whole oneliner in a file, like this:
And then run it passing file names as a command line arguments (perl script.pl my_log_1.log my_log_2.log) or feeding them to STDIN (cat my_log_*.log | perl script.pl).#!/usr/bin/perl -n # note the -n switch use Date::Parse; 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}
Sorry if my advice was wrong.
|
---|
In Section
Seekers of Perl Wisdom