tail -f | grep

whenever whatever at whoever.net
Sun Nov 19 20:55:27 PST 2000


forgot to let you know it catch only the new messages that's appended to the endof the 'messages' file, after it start running.
On Sun, Nov 19, 2000 at 06:50:03PM -1000, whenever wrote:
> Yes, it does.., did you changed the file location to fit your need?
> perl location, the messages file location and finally your log file /location/name.   It works fine on a slackware system.
> 
> On Sun, Nov 19, 2000 at 03:53:30PM -1000, Mike Ballon wrote:
> > 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;
> > > }
> > > }
> > >



More information about the LUAU mailing list