This code does not give me correct output. Correct output according to my logfile is 142 but it gives me 352. I want to count it in between these lines#!/usr/bin/perl my $logFile = $ARGV[0]; die "usage: $0 <logFile>" unless $logFile; die "Logfile $logFile doesn't exist" unless -f "$logFile"; open($log, "<", $logFile) or die "Can't open $logFile for reading."; print "Processing file $logFile...\n"; my $n = 0; my $ArcotIDError_Count = 0; my $QnAError_Count = 0; my $UPError_Count = 0; my $OTPError_Count = 0; my $errorCode; while( $line = <$log> ) { $n++; $line =~ tr/\r\n//d; if ($line =~ /recvd AA_BIN_MSG_VER_CHG/) { while( $line = <$log> ) { if($line =~ /Handling NSPAdvice for mechanism \[4\]/) { while ( $line = <$log> ) { if ($line =~ /Authentication mechanism returne +d \[(\d+)\]/) { my $errorCode = $1; print "$errorCode\n"; if ($errorCode != 0 && $errorCode != 1) { $ArcotIDError_Count++; } } } } } } } print "Total Number Of ArcotID Authentication ErrorCode returned i +s $ArcotIDError_Count\n";
I can check the begining statement here but for end statement(so that i always get the out between those lines) what change needed in the code. Thanks NTstarting point- Apricot Native Server: recvd AA_BIN_MSG_VER_CHG and ending point- (Prepared to Send OK) OR (Sending Invalid credential).
In reply to only print data ie between two lines by namishtiwari
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |