in reply to Re^3: Match 2 strings in same line
in thread Match 2 strings in same line
my $logsIncDate = `date +"%b %d %H"`; my @eigrp = (); open SwitchLogs, $logFile or die "Could not open $logFile: $!"; while (<SwitchLogs>) { chomp; my $line = $_; if($line =~ m/$logsIncDate/ && $line =~ m/SW_MATM-4-MACFLAP_NOTIF/ +){ push(@eigrp, "$line\n"); $sendemail = 1; } }
All I want to do is to match the date/time in a line that contain the specified string. So the above code should catch the below one line:
Nov 25 10:59:13 10.1.162.11/10.1.162.11 1410: Nov 25 16:59:12.724: %SW +_MATM-4-MACFLAP_NOTIF: Host 30ff.0c00.d4be in vlan 162 is flapping be +tween port Fa0/13 and port Fa0/10
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Match 2 strings in same line
by kennethk (Abbot) on Nov 25, 2013 at 17:29 UTC | |
by hmb104 (Sexton) on Nov 25, 2013 at 17:33 UTC | |
|
Re^5: Match 2 strings in same line
by Tux (Canon) on Nov 25, 2013 at 17:30 UTC |