From 8372a282d648350c7a54b6221eee0e2706e6a88c Mon Sep 17 00:00:00 2001 From: scottnotrobot Date: Tue, 8 Aug 2017 14:34:28 -0700 Subject: [PATCH] spaces may not appear in some parts of the rrdtool dump --- contrib/removespikes.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/removespikes.pl b/contrib/removespikes.pl index e52908d3b..7061cea82 100755 --- a/contrib/removespikes.pl +++ b/contrib/removespikes.pl @@ -97,10 +97,10 @@ $cdo=0; if ($linea=~/^(.*)/) { $tstamp=$1; } if ($linea=~/(.*)$/) { $tresto=$1; } - if (/\s\d\.\d+e.(\d+)\s<\/v>/) { + if (/\s?\d\.\d+e.(\d+)\s?<\/v>/) { @dump = split(/<\/v>/, $tresto); for ($lino=0; $lino<=$#dump-1; $lino++) { # scans DS's within each row - if ( $dump[$lino]=~/\d\.\d+e.(\d+)\s/ ) { # make sure it is a number (and not NaN) + if ( $dump[$lino]=~/\d\.\d+e.(\d+)\s?/ ) { # make sure it is a number (and not NaN) $a=substr("0$lino",-2).":".$1; $exp{$a}++; # store exponents $tot{substr("0$lino",-2)}++; # and keep a per DS total @@ -146,11 +146,11 @@ $cdo=0; if ($linea=~/^(.*)/) { $tstamp=$1; } # Grab timestamp if ($linea=~/(.*)$/) { $tresto=$1; } # grab rest-of-line :-) - if (/\s\d\.\d+e.(\d+)\s<\/v>/) { # are there DS's? + if (/\s?\d\.\d+e.(\d+)\s?<\/v>/) { # are there DS's? @dump=split(/<\/v>/, $tresto); # split them if ($linbak ne '') { for ($lino=0;$lino<=$#dump-1;$lino++) { # for each DS: - if ($dump[$lino]=~/\d\.\d+e.(\d+)\s/) { # grab number (and not a NaN) + if ($dump[$lino]=~/\d\.\d+e.(\d+)\s?/) { # grab number (and not a NaN) $c=$&; $a=$1*1; # and exponent $b=substr("0$lino",-2).":$1"; # calculate the max percentage of this DS