Hi Monks!
I have this program that generated this very large log file, it is now actually about 75MB long. What I am trying to do here is delete everything prior to a certain date, my simple regular expression finds any date but how can I accomplish once it is found the date delete everything else prior to that date and keep the rest of the file. This small program only shows a sample of what I am trying to do, testing the regular expression. The actual log file looks like the commented code below.
#!/perl/bin/perl -w use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); print header(); my $text = "TICKETHELP###,########,1234567###,2005,X,Y,356.00###,2006- +5-8 17:44:44,TICKETHELP###########1234567###2005XY356.00###,World Cup + List,John Marck"; if($text=~/(2006-5-8)/g) { print "found = $1"; }else{ print "Nothing"; } =comment TICKETHELP###,########,1234567###,2004,X,Y,35.00###,2004-5-2 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1234567###,2005,X,Y,16.00###,2005-3-8 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1234567###,2006,X,Y,23.00###,2006-1-3 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,0933456###,2005,X,Y,33.00###,2005-5-7 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1234567###,2005,X,Y,87.00###,2005-5-4 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1984567###,2005,X,Y,32.00###,2005-3-8 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1234567###,2005,X,Y,67.00###,2006-5-2 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1223698###,2000,X,Y,79.00###,2000-1-1 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck TICKETHELP###,########,1299n67###,2001,X,Y,26.00###,2001-5-5 17:44:44, +TICKETHELP###########1234567###2005XY356.00###,World Cup List,John Ma +rck =cut


Thanks for the Help!

In reply to Deleting lines prior to a date! 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.