reading from updated file

reading from updated file

am 27.11.2006 15:58:52 von devon_banks

I have been wondering if there is a simple way to read from a file
that is constantly being updated. How do you do this without reading
duplicates?
I guess the most pervasive example would be a log file.
I've seen where some perl scripts can do this such as swatch but
have never figured out what they were doing. Is there a recommended
standard way of doing this?
Do you have to read the whole file each time you scan for updates?

Re: reading from updated file

am 27.11.2006 16:07:18 von Paul Lalli

Devon Banks wrote:
> I have been wondering if there is a simple way to read from a file
> that is constantly being updated. How do you do this without reading
> duplicates?
> I guess the most pervasive example would be a log file.
> I've seen where some perl scripts can do this such as swatch but
> have never figured out what they were doing. Is there a recommended
> standard way of doing this?
> Do you have to read the whole file each time you scan for updates?

I would recommend the CPAN module File::Tail, which is designed
specifically for this task. Read about it and download it at:
http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm

Paul Lalli

Re: reading from updated file

am 27.11.2006 20:29:10 von paduille.4060.mumia.w

On 11/27/2006 08:58 AM, Devon Banks wrote:
> I have been wondering if there is a simple way to read from a file
> that is constantly being updated. How do you do this without reading
> duplicates?
> I guess the most pervasive example would be a log file.
> I've seen where some perl scripts can do this such as swatch but
> have never figured out what they were doing. Is there a recommended
> standard way of doing this?
> Do you have to read the whole file each time you scan for updates?

I assume that you have ActiveState Perl for Windows and its
documentation installed, so do this:

Start->Run->"perldoc -q tail"

For more information about perl, do this:

Start->Run->"perldoc perl"

If you are using Linux, open an X-terminal and type this:

perldoc -q tail

.... and this ...

perldoc perl


Good luck


--
paduille.4060.mumia.w@earthlink.net

Re: reading from updated file

am 27.11.2006 21:25:55 von Paul Lalli

Mumia W. (reading news) wrote:
> On 11/27/2006 08:58 AM, Devon Banks wrote:
> > I have been wondering if there is a simple way to read from a file
> > that is constantly being updated. How do you do this without reading
> > duplicates?
> > I guess the most pervasive example would be a log file.
> > I've seen where some perl scripts can do this such as swatch but
> > have never figured out what they were doing. Is there a recommended
> > standard way of doing this?
> > Do you have to read the whole file each time you scan for updates?
>
> I assume that you have ActiveState Perl for Windows

I wonder what made Mumia assume that, as nothing in the OP's post
suggested or implied it.

> and its documentation installed, so do this:
>
> Start->Run->"perldoc -q tail"
>
> For more information about perl, do this:
>
> Start->Run->"perldoc perl"

.... unless, of course, you'd like to be able to actually *see* the
results of that command, rather than just the flash of a black box on
your screen. In that case, do:
Start->Run>"cmd"
and then type one of the commands Mumia put in double quotes above.

Paul Lalli

Re: reading from updated file

am 28.11.2006 03:15:03 von devon_banks

On Mon, 27 Nov 2006 07:07:18 -0800, Paul Lalli wrote:

> Devon Banks wrote:
>> I have been wondering if there is a simple way to read from a file
>> that is constantly being updated. How do you do this without reading
>> duplicates?
>> I guess the most pervasive example would be a log file.
>> I've seen where some perl scripts can do this such as swatch but
>> have never figured out what they were doing. Is there a recommended
>> standard way of doing this?
>> Do you have to read the whole file each time you scan for updates?
>
> I would recommend the CPAN module File::Tail, which is designed
> specifically for this task. Read about it and download it at:
> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm
>
> Paul Lalli

Thanks for your replies, I haven't used ActiveState perl for a
while. I've always been concerned about writing a perl script
and finding a system doesn't have it installed. Of course for
windows I would use it.
Thanks again.

Re: reading from updated file

am 28.11.2006 12:45:41 von Paul Lalli

On Nov 27, 9:15 pm, Devon Banks wrote:
> On Mon, 27 Nov 2006 07:07:18 -0800, Paul Lalli wrote:
> > I would recommend the CPAN module File::Tail, which is designed
> > specifically for this task. Read about it and download it at:
> >http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm
>
>Thanks for your replies, I haven't used ActiveState perl for a
> while. I've always been concerned about writing a perl script
> and finding a system doesn't have it installed. Of course for
> windows I would use it.

My response has nothing to do with ActiveState - that was all Mumia.
My recommendation of using File::Tail is valid for any operating
system.

Paul Lalli