my $prev_line = ""; while ( my $line = <$log> ) { if ( $line =~ /Auth\s+failed./ ) { ... # error message should be in $prev_line } $prev_line = $line; }
In reply to Re: grep previous line of the matched string
by Transient
in thread grep previous line of the matched string
by namishtiwari
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |