Really? So constantly piping the results of a log file through a function to sort the data is not the best method of giving real time data based on the piped output of a log file?

Bowie Bailey wrote:

Jason Gerfen wrote:
I am looking to do something which I am not sure perl can do.  I would
like to be able to issue a system command ex. tail -f /file and loop
over that command while sorting the output.  Is this possible?  And if
so could I see an example?

   open(LOG, "tail -f /var/log/messages |");
   while (<LOG>) {
       if (/something important/) {
           print "Found something...\n";
       }
   }
   close LOG; # Never get here, but for completeness...
I'm not sure what you mean by sorting the output. Since there is
continuous input, there will be continuous output.  You could sort and
display aggregated output at intervals rather than having a real-time
output stream.



--
Jason Gerfen

"When asked what love is:
Love is the Jager talking."
~Craig Baldo

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to