Hi, I would like to filter my log file within time range For example my log.txt as below, and I want to get data only if the 2nd coloumn is from 05:00:00 until 24:00:00
"02-feb-2010","04:59:12;09 ","00:00:06;27 " ,"ABC1234 " +,"ABC1234","ABC1234","610A/03","00:08:19;28 ","00:08:26;24.","02-feb- +2010","04:59:19;06 " "02-feb-2010","04:59:19;06 ","00:00:15;00 " ,"creeid00402 + ","OY00402W","OY00402W","610D/00","04:00:00;00 ","04:00:14;29.","02 +-feb-2010","04:59:34;06 " "02-feb-2010","04:59:34;06 ","00:29:01;25 " ,"ihw-14ubc-q + ","3316291-","3316291-","610E/00","03:00:00;00 ","03:29:01;24.","02 +-feb-2010","05:28:35;29 " "02-feb-2010","05:28:35;29 ","00:00:15;00 " ,"creeid00402 + ","OY00402W","OY00402W","610D/00","04:00:00;00 ","04:00:14;29.","02 +-feb-2010","05:28:50;29 " "02-feb-2010","05:28:50;29 ","00:00:30;00 " ,"scifim10078 + ","SF10078W","SF10078W","610F/00","02:00:00;00 ","02:00:29;29.","02 +-feb-2010","05:29:21;01 " "02-feb-2010","05:29:21;01 ","00:00:15;00 " ,"creeid00402 + ","OY00402W","OY00402W","610D/00","04:00:00;00 ","04:00:14;29.","02 +-feb-2010","05:29:36;01 "
I tried to use grep, but I have no luck and I don't have any idea how to range the time.
grep -e "(.*),("05:.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*)"
I also tried
my @lines = (); push @lines, $_ if /(.*),("05:.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*), +(.*),(.*)/; foreach my $line (@lines) { print "LINE : " . $lines[0] ." \n"; }
Can someone help me please. Thanks,

In reply to Filter log file within time range by geek.shrek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.