*nix tail -f multiple log files with Thread

Joe Riopel goon12 at gmail.com
Fri Feb 13 13:59:58 EST 2009


On Fri, Feb 13, 2009 at 12:03 PM, David <david at abbottdavid.com> wrote:
> Hi everyone,
>
> I copied a program from C to track multiple log files. I would like to be
> able to print a label when a log file is updated. Here is the program;

Since you're calling tail itself, why not just use tail's ability to
tail multiple files? It too will output the label.

I am using tail from the GNU coreutils, version 5.97.

I did the following, using two xterms:

First, in one xterm window:
$ touch foo bar
$ tail -f foo bar

Then in another xterm:
$ echo "Hi foo" > foo
$ echo "Hi bar" > bar

Back in the first xterm window I see this:
$ tail -f foo bar
==> foo <==

==> bar <==

==> foo <==
Hi foo

==> bar <==
Hi bar



More information about the Python-list mailing list