Quick and dirty:
use strict; use warnings; while (<DATA>) { my $time = (split /,/)[1]; my ($hr) = $time =~ /^"(\d\d)/; print if $hr>=5 and $hr<=23; } __DATA__ "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 "
If any of your fields could have commas, you'd be better off with a CSV parser, such as Text::CSV_XS.

In reply to Re: Filter log file within time range by toolic
in thread 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.