This script may take a while to run, especially on a busy podmaster.
Generating Syslog TopN list on node for last 3 hours.
Top 5 hosts for Day: Oct8 between 02:
There's nothing wrong with your regex.
That's just a formatting difference:
use strict;
use warnings;
my $data = do {local $/; };
my @ones = $data =~ m/^\s*[1]\s+([\d]+)/mg;
for my $i (0..$#ones) {
printf "\$%d = %s\n", $i+1, $ones[$i];
}
__DATA__
Rank Number of Alerts Host
---- ---------------- ----
1 3124 abc
2 2294 bcd
Rank Number of Alerts Host
---- ---------------- ----
1 5495 cdf
2 2625 klm
Rank Number of Alerts Host
---- ---------------- ----
1 2747 lll
2 876 jjj
Outputs:
$1 = 3124
$2 = 5495
$3 = 2747
live demo