Hi Dave, Here is a bit more code:
$earliest0 = `more $ARGV[0]| grep -v Epoch > newfile.txt| head -1 newf +ile.txt`; @Array0 = split(' ',$earliest0); $date0 = "@Array0[0] @Array0[1]"; $earliest1 = `more $ARGV[1]| grep -v Epoch > newfile1.txt| head -1 new +file1.txt`; @Array1 = split(' ',$earliest1); $date1 = "@Array1[0] @Array1[1]"; if($date0 eq $date1){$early = $ARGV[0]; $late = $ARGV[1];} if($date0 lt $date1){$early = $ARGV[0]; $late = $ARGV[1]; $File = "newfile.txt"; open(File); $i = 0; while(<File>){ @check = split(' ',$_); $date = "@check[0] @check[1]"; if($date eq $date1){last;} $i++; } } if($date1 lt $date0){$early = $ARGV[1]; $late = $ARGV[0]; $File = "newfile1.txt"; open(File); $i = 0; while(<File>){ @check = split(' ',$_); $date = "@check[0] @check[1]"; if($date eq $date0){last;} $i = $i++; } }
The  while statements are needed to determine which line number matches the latest date. I tried using regular expressions to do this but could not figure it out. When I execute this script it sometimes returns the correct $i, sometimes executes the wrong $if statement. Thanks!

In reply to Re^2: Time matching YYYY-MM-DD HH:MM:SS.SSS by PRyanRay
in thread Time matching YYYY-MM-DD HH:MM:SS.SSS by PRyanRay

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.