Hi,
Yes, I have a trouble in parsing through the raw log. I am using the
"-->" symbol to parse through the log.
From
--------------------------------------
--> Validating DNS Server Entries <--
--------------------------------------
Servers should conform to global ANYCast Standard
DNS Name : xxxxxx [WARNING]
Please check the DNS name.
To
--------------------------------------
--> Validating APP Server Entries <--
--------------------------------------
I want to extract only the block which has the key word [WARNING]
I have the following code
my ($field_type);
my (%warning, $warning_count);
my $server_name = "baeed on file name";
while (<FILE>)
chomp;chomp;
my ($line) = $_;
if ($line =~ /-->.*<--/) {
$field_type = $line;
$field_type =~ s/-->(.*)--</$1/;
}
if ($line =~ /WARNING/) {
my ($match) = $server_name ." - ".$field_type." - ".$line;
$warning{$match} = 1; #not great, but works
$warning_count++;
}
}
But this doesn't give me the required output.
Thanks.
On Nov 24, 8:04 am, [EMAIL PROTECTED] (Tom Phoenix) wrote:
> On 11/23/07, Avinash S <[EMAIL PROTECTED]> wrote:
>
>
>
> > I need to format the below logs.
> ...
> > after this I want to send a mail.
>
> Sounds like you know what you want to do. Are you having trouble
> implemening any part of it in Perl?
>
> Cheers!
>
> --Tom Phoenix
> Stonehenge Perl Training
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/