in reply to Shifting the top line(s) of a file?

An alternative way that has a better performance (as it uses less expansive file operations):

  1. Instead of using one file, use a series of files. Numbering them, so they come in sequence.
  2. have a size limitation on files. You always append to the last file, but when it reaches its size limitation, create a new file.
  3. when you read, you always read from the first file, and remember the last line you read, next time, just continue from there. Once all lines are read, delete the first file, and go to the new first (by having some simple numbering mechanism, you will always know which file is the first.)
  • Comment on Re: Shifting the top line(s) of a file?