Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Extract new lines from log file

by BrowserUk (Patriarch)
on Jan 02, 2007 at 19:55 UTC ( [id://592622] : note . print w/replies, xml ) Need Help??

in reply to Extract new lines from log file

Why not store the filesize instead of the line count? Then your 5 steps become

  1. Query filesize
  2. If the file has grown since last time, open the file and seek to the previous eof.
  3. Read the new lines and persist the new filesize.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.