Perl - marker ?

Discussion in 'Perl Misc' started by Kevin, Jan 20, 2009.

  1. Kevin

    Kevin Guest

    I want to be able to read a text file every 10 minutes or so. Since
    the file can get pretty large over time, I want to pick up where I
    left off earlier. Is this possible using Perl ?

    -Kevin.
    Kevin, Jan 20, 2009
    #1
    1. Advertising

  2. >>>>> "Kevin" == Kevin <> writes:

    Kevin> I want to be able to read a text file every 10 minutes or so. Since
    Kevin> the file can get pretty large over time, I want to pick up where I
    Kevin> left off earlier. Is this possible using Perl ?

    search.cpan.org - enter "File::Tail".

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
    See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
    Randal L. Schwartz, Jan 20, 2009
    #2
    1. Advertising

  3. Kevin <> writes:

    > I want to be able to read a text file every 10 minutes or so. Since
    > the file can get pretty large over time, I want to pick up where I
    > left off earlier. Is this possible using Perl ?


    The tell() function can tell you the current position in a file and
    the function seek will take you to a given position in a file. Then
    you just need to store this offset somewhere.

    If you have a long running perl process which reads to the end of
    file, waits ten minutes and want to read further, you can use seek to
    clear the end of file-state without reopening the file or without
    using tell. $fh->clearerr() should do the same.

    //Makholm
    Peter Makholm, Jan 20, 2009
    #3
  4. Kevin <> wrote:
    >I want to be able to read a text file every 10 minutes or so.


    perldoc -f sleep
    perldoc -q timeout

    >Since
    >the file can get pretty large over time, I want to pick up where I
    >left off earlier. Is this possible using Perl ?


    perldoc -f seek

    You could also take a look at "perldoc -q tail"

    jue
    Jürgen Exner, Jan 20, 2009
    #4
  5. On 2009-01-20, Jürgen Exner <> wrote:
    > Kevin <> wrote:
    >>I want to be able to read a text file every 10 minutes or so.

    >
    > perldoc -f sleep
    > perldoc -q timeout
    >
    >>Since
    >>the file can get pretty large over time, I want to pick up where I
    >>left off earlier. Is this possible using Perl ?

    >
    > perldoc -f seek
    >
    > You could also take a look at "perldoc -q tail"


    What the heck? That was here exactly a month before. What's going on
    with you guys?
    <>

    --
    Torvalds' goal for Linux is very simple: World Domination
    Stallman's goal for GNU is even simpler: Freedom
    Eric Pozharski, Jan 21, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Henry

    top level marker?

    Brian Henry, Dec 26, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    358
    Brian Henry
    Dec 27, 2003
  2. =?Utf-8?B?V2FubmFiZV9HZWVr?=

    Marker in ASP.Net

    =?Utf-8?B?V2FubmFiZV9HZWVr?=, May 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    601
    Alvin Bruney [MVP - ASP.NET]
    May 14, 2005
  3. X_AWieminer_X
    Replies:
    2
    Views:
    12,279
    JomoFrodo
    Aug 18, 2011
  4. pentium
    Replies:
    3
    Views:
    407
    bilbo
    Nov 22, 2004
  5. beginner
    Replies:
    19
    Views:
    842
    Ben Finney
    Aug 2, 2007
Loading...

Share This Page