Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl - marker ?

Reply
Thread Tools

Perl - marker ?

 
 
Kevin
Guest
Posts: n/a
 
      01-20-2009
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.
 
Reply With Quote
 
 
 
 
Randal L. Schwartz
Guest
Posts: n/a
 
      01-20-2009
>>>>> "Kevin" == Kevin <(E-Mail Removed)> 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
<(E-Mail Removed)> <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
 
Reply With Quote
 
 
 
 
Peter Makholm
Guest
Posts: n/a
 
      01-20-2009
Kevin <(E-Mail Removed)> 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
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      01-20-2009
Kevin <(E-Mail Removed)> 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
 
Reply With Quote
 
Eric Pozharski
Guest
Posts: n/a
 
      01-21-2009
On 2009-01-20, Jürgen Exner <(E-Mail Removed)> wrote:
> Kevin <(E-Mail Removed)> 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?
<(E-Mail Removed)>

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write UTF-8 BOM marker char8s) at the start of file? X_AWieminer_X Java 2 08-18-2011 05:44 PM
Python end of file marker similar to perl's __END__ beginner Python 19 08-02-2007 10:07 PM
Marker in ASP.Net =?Utf-8?B?V2FubmFiZV9HZWVr?= ASP .Net 1 05-14-2005 12:42 AM
top level marker? Brian Henry ASP .Net 2 12-27-2003 01:47 AM
HTML text marker Joerg Firefox 5 09-18-2003 01:56 AM



Advertisments