Re: file like, regular expression driven, content splitter



In comp.os.linux.misc, Markus <markus.mj@xxxxxxxxx> wrote:
My idea is something like virtual device instead of the applog.log
file which would be configured with regular expression rerouting every
incoming line into separate log file. Filter is driven by the regex in
configuration.

Named pipes. One side writes to a file name, one side reads from it,
it works just like a | on the command line. Creation is simple:

mknod applog.log p

Both sides open it like a regular file, one to write and read. The
writer will block if the pipe fills up, so the reader client should
start first. Example reader:

#!/usr/bin/perl -w

open(INPUT, '<', 'applog.log') || die "$0: can't read log!";
open(OUT1, '>', ...
open(OUT2, '>', ...
...
open(OUTN, '>', ...

while(<INPUT>) {
if(/pattern1/) { print OUT1; next; }
if(/pattern2/) { print OUT2; next; }
...
# default fallback
print OUTN;
}
__END__

Elijah
------
test carefully, the writer will block if the reader dies
.



Relevant Pages

  • [SLE] Help with combo drive and K3b
    ... Logged in as root, I get the following entries under ... Reader: No entry ... CD-Text Capable: auto ... I have run the configuration utility under YaST2 in an attempt to ...
    (SuSE)
  • Re: PC/SC reader
    ... I didn't try that specific configuration, but it may be it is possible. ... COM1: deviice available before SCR1: tries to load. ... Is it possible to connect with a PC/SC reader wich is ... > physically connected to a PC from the Windows CE Emulator using platform ...
    (microsoft.public.windowsce.platbuilder)
  • Re: BTR question
    ... The reader is a GE but it is 150cps. ... The connector on the end of the 20-wire ribbon cable ... BTR in a machine with this configuration? ... > installed an ADR BTR on one and don't remember any particular problems. ...
    (alt.machines.cnc)
  • CF reader/writer
    ... usb cf reader and the configuration of same. ... I plan on using it to ...
    (alt.os.linux.suse)