The data is simple enough, a record per line. But there may be
some lines that aren't valid records. I want to read only the
first valid record and the last valid record without processing all the lines in between to see if they are valid.
(Some files have over 1-million lines).
I have an idea how I might do it:
read from the top until I get to the first valid record.
seek the end of the file minus some reasonable block of bytes (figured from lines and bytes/line).
read the block until I get to the last valid record
if there aren't any valid records, back up one more, block, etc.
It doesn't appear hard, but you never know.. and besides, I much prefer to use code that is alread written (lazy boat bum).
Anyone know of a module that has this in it or working code?
Or improvements on the algorithm?
perlcapt