#!/usr/bin/perl -w
##########################################################################
# $Id: expandrepeats,v 1.3 1998/02/23 01:17:03 kirk Exp $
##########################################################################
# $Log: expandrepeats,v $
# Revision 1.3  1998/02/23 01:17:03  kirk
# Getting ready for a first distribution
#
# Revision 1.2  1998/02/22 23:28:25  kirk
# Commented and rearranged some things
#
# Revision 1.1  1998/01/25 01:41:33  kirk
# Added 'messages' log processors
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Kirk Bauer <kirk@kaybee.org>
#
# Please send all comments, suggestions, bug reports,
#    etc, to kirk@kaybee.org.
#
########################################################

# This will expand "Last Message Repeated n Times" messages in 
# standard /var/log/messages formatted log files...

$LastLine = "";

while (defined($ThisLine = <STDIN>)) {
   if ($ThisLine =~ m/last message repeated ([0123456789]+) times$/) {
      for ($i=0;$i<$1;$i++) {
         print $LastLine;
      }
   }
   else {
      print $ThisLine;
      $LastLine = $ThisLine;
   }
}
