Something like:
use strict; use warnings; my $time = time(); my $days = 45; my ($day, $mon, $mday, $hour, $min, $sec, $zone, $year, $depth, $flag) +; while (read(DATA, $_, 45)) { if (!$flag) { ($day, $mon, $mday, $hour, $min, $sec, $zone, $year, $depth) = unpack('A3xA3xA2xA2xA2xA2xA3xA4x14A3', $_); # Use module to convert to timestamp $mytime if ($mytime > $time - 86400 * $days) { print $depth; $flag = 1; } } else { ($depth) = unpack('x42A3', $_); print $depth; } } __DATA__ Fri Dec 3 23:07:21 EST 2004 : Depth is : 234Sat Dec 4 00:07:29 EST 2 +004 : Depth is : 123Sat Dec 5 03:07:32 EST 2004 : Depth is : 144

Problem is, I don't know a good module for creating a timestamp out of the date information. Maybe someone else can insert that part for me?


In reply to Re: grep for last 45 days by TedPride
in thread grep for last 45 days by Anonymous Monk

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.