in reply to Perl Tail ?

Is there any need for you to read in the whole file?
@lines=<TF>;
Why not simply read line by line and don't store them?

$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print

Replies are listed 'Best First'.
Re^2: Perl Tail ?
by perlAffen (Sexton) on Oct 04, 2005 at 15:46 UTC
    So this is an efficient way to do the Unix equivalent ?
    tail -f logfile > tailfile
    I would like to tail it for 10 minutes, restart the tail process for another 10 mintues, copying off tailfile to tailfile.chunk before writing to tailfile again. COuld I use this to do it ? I will check tail archives too.
      I recall many years ago that unix tail is broken on large files, such that I wrote my own Perl tail for one job. You might want to look at tail for Perl Power Tools.

      I would like to tail it for 10 minutes, restart the tail process for another 10 mintues, copying off tailfile to tailfile.chunk before writing to tailfile again
      Please be more specific. Are you intending to skip (lose) 10 minutes of logfile? Do you just want to split the logfile into chunks at 10 minute intervals?

      What is the fundamental problem you're trying to solve?

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        I would just like the code above to NOT read from the beginning, that is all I really need. Thanks
        upon reflection I would like to make my posted code NOT read from the begining. that is all really. thanks

        2005-10-05 jdporter Edited title of this node and the others in the same subthread: somehow, the 'Perl Tail ?' part got lost