Forum Moderators: coopster & phranque

Message Too Old, No Replies

Display in pages

         

perl12

4:57 am on Jan 30, 2004 (gmt 0)

10+ Year Member



Hi,
I have a script which displays all the "errors" & "warnings" in a log file . But this script when run will also display the lines which contain the words "errors" & "warnings" along with the actual errors in the log files.Is there any way to avoid this?
One more thing is what modification I should do in this script so that the errors displayed will be in pages ie how do i use "ls ¦ more" in thie script?
my script is :

#! /usr/atria/bin/Perl

$error = `find . -type f -print ¦ xargs perl -ne 'print if /error¦warning/'`;
print "$error\n" ;

waiting for response.
Perl12

Laxters

6:42 pm on Jan 30, 2004 (gmt 0)

10+ Year Member



You could try a closer match to the exact error messages.

For example, if you knew one of the lines you're looking for has "404 Error" in it, you could try:

if ($_ =~ /404 Error/)
{
print ("$_");
}

The closer you can match, the better.