tail -f | grep

Mike Ballon calzonie at hawaii.rr.com
Sun Nov 19 17:53:30 PST 2000


No, did it work on your box?

----- Original Message -----
From: "whenever" <whatever at whoever.net>
To: "Linux Users Anonymous" <luau at luau.hi.net>
Sent: Friday, November 17, 2000 10:37 PM
Subject: [luau] tail -f | grep


> Does this work for you?, runnig it with nohup or & if you don't want it to
die after logout.
>
> #!/usr/bin/perl
> # ^^^^^ change to your perl location
> #keep reading messages and log Sex.txt to your.log.file
>
> while (1) {
> open LOG, '/var/adm/messages' || die "no can open file: $!";
>
> seek(LOG,0,2);
> for(;;) {
> headerloop: while(<LOG>)
> {
>         chomp;
> # change the filter rule as needed
>         if (/.*(Sex.txt).*/)
>         {
> # change next line to fit your file location
>         open YOURLOG, '>> /some/where/your.log.file' || die "can not write
to file";
>         print YOURLOG "$_","\n";
>         }
>
> }
> sleep(1);
> seek(LOG,0,1);
> close YOURLOG;
> }
> }
>
> ---
> You are currently subscribed to luau as: calzonie at hawaii.rr.com
> To unsubscribe send a blank email to $subst('Email.Unsub')



More information about the LUAU mailing list