Thanks for all of your input. Here is the code snipped I used:
# Timestamp 12 hours ago my $twelve_hours_ago = strftime("%Y-%m-%d/%H:%M:%S", (localtime(time-$ +hours*3600))); # Logfile may have been rotated during the past 12 hours. Thus we mus +t open # any logfile that is less than 12 hours old. find(\&wanted, "$logfile"); sub wanted { # Open loge file if it is less than 12 hours old and the # correct file name if ( (stat $_)[9] > time() - (3600 * $hours) && m/^log_file/ ) { # Debugging lines #print "file: ".$_."\n"; #my $stat = (stat $_)[9]; #print "stat: ".$stat."\n"; #my $twelve = time() - (3600 * $hours); #print "twelve: ".$twelve."\n"; # End of debugging lines. open LF, ($_) || die "Cannot open $logfile $!"; while (<LF>){ # Check for PASS log entry next unless (m/log :Monitor: CALLER Status \*PASS\*/); # Check timestamp $date = $1 if (m/^([^.]+)/); # Grab the date up to secon +ds next unless $date gt $twelve_hours_ago; #print "date: ".$date."\n"; # For debugging. # Count number for passes. $passcount++; # Save log line push @passlogs, $_; } } }

Neil Watson
watson-wilson.ca


In reply to Re: Parsing timestamps by neilwatson
in thread Parsing timestamps by neilwatson

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.