Hello,
I've searched high and low for the answer to my problem, but I've yet to see an example that addresses what I am trying to do. I am hoping that you can help..
Basically, I am reading in a file that in filled with multiple-line log entries. The first line of each log entry has the date (amongst other items) in it in the mm/dd/yyyy format. This Perl script is launched via a web form when a person provides the date that they'd like to search through the logs for (via a dropdown menu on the webpage). If the date that the user requests matches the date in the logfile, it should print everything from that first matching line until the very end of the file. The log is set up in such a manner that the day that the person is requesting will always be the latter portion of the file.
With this in mind, here's the code block in question:
LINE: while ($currentfile=<FILE>) {
if ($currentfile =~ /^[0-9][0-9][0-9][0-9][0-9][0-9]/){
$match_date = substr($currentfile,52,10);
if ($search_date eq $match_date) {
print RESULTS "$currentfile";
do {
next LINE;
print RESULTS "$currentfile";
} until eof();
} #if search_date
} # if $currentfile
}
}
One other note, the reason that I am trying to match on that particular reg ex is because the first line of each log entry (which also includes the date in mm/dd/yyyy format) begins with a six digit sequence number (with leading zeroes).
Thanks very much in advance for any guidance!