#!/usr/local/bin/perl # # this program zeros out a specified portion of a mrtg log file to # remove a section of data that was collected erroneously, such as # from the wrong mib instance. # # $ARGV[0] = file to fix # $ARGV[1] and $ARGV[2] specify the time block to fix # if ($ARGV[1] > $ARGV[2]) { $max = $ARGV[1]; $min = $ARGV[2]; } else { $max = $ARGV[2]; $min = $ARGV[1]; } open(INFILE,"$ARGV[0]"); while() { chomp; @pieces = split; if (($pieces[0] <= $max)&&($pieces[0] >= $min)) { print "$pieces[0] 0 0 0 0\n"; } else { print "@pieces\n"; } }