[Tutor] parsing a continuous log file

bhaaluu bhaaluu at gmail.com
Fri Nov 30 14:11:04 CET 2007


On Nov 29, 2007 3:28 PM, ray sa <bizag007 at yahoo.com> wrote:
> Hello
>
> I need some help. I am working with a program that dumps a continuous file
> while the program is running. This file contains loads of information and I
> am only looking for a small amount of the data.
>
> I have written the program below:
>
[snip]
>
> closed and the file stops growing it should exit. I was checking with google
> and came accross a command used in UNIX called the tail command.

The UNIX 'tail' command with the -f option does this.
$ tail filename   <-- by default, the last 10 lines will be shown,
then tail exits.
$ tail -n20 filename  <-- the last 20 lines are shown, then tail exits
$ tail -f filename  <-- follow the end of the file

--from the manual:
-f, --follow[={name|descriptor}]
     output  appended data as the file grows;
     -f, --follow, and --follow=descriptor are equivalent

One of the benefits of Open Source (Free) Software is that the source code
can be studied, modified, and freely shared with the community.

>
> May be someone can help me to achieve the same result with modifying the
> above code? Also the file could be up to 200 MB long.
>
> Many thanks for your kind help. /Ray
>

May the Source be with you! 8^D
-- 
b h a a l u u at g m a i l dot c o m


More information about the Tutor mailing list