in reply to not getting desired output

You need to change:

if($line =~ /Handling NSPAdvice for mechanism [4]/) {

to

if($line =~ /Handling NSPAdvice for mechanism \[4\]/) {

because the character [ is special in a regular expression.

Update: Your logic in the statement:

if ($errorCode != 0 || $errorCode != 1) {

is flawed because an $errorCode with any number will pass this test.   You probably meant:

if ($errorCode != 0 && $errorCode != 1) {

Replies are listed 'Best First'.
Re^2: not getting desired output
by namishtiwari (Acolyte) on Jun 11, 2009 at 15:46 UTC
    Hi , Thanks for your reply, that part got reolved, but i am not getting the desired output. I need to count all except 0 and 1 for mechanism, but in the output file, i can see all are printed and counted.Some logic problem i guess. Please suggest me what i am doing wrong. Thanks NT