Suggested starting point
- Read the file into an array
- if $log_file[7]=~ /matches this/
- then $date = $log_file[0]
- else splice(@files,0,8) (Updated on the wise advice of moritz below)
Code that up, and see if it works, if not we can have a look, however without code or sample data we can only really have a punt @ this, the line to match may have unique characteristics, the other records may be different lengths, etc..