#!/usr/bin/perl
use Getopt::Std;
getopts('it:');

my @tests = @ARGV;

my $sub = '
        while (<STDIN>) {
';
if ( defined $opt_t ) {
	  $sub .= '
	  my($time) = /\btime=(\d+)/;
	  '.(defined $opt_i ? 'next if ( defined $time && '.$opt_t.' > $time );':'').'
';
}

foreach my $test (@tests) {
          $sub .= q{ s/\b\Q}.$test.q{\E\b//g; };
}
$sub .= '
            s/,,+/,/g; s/,+$//; s/ ,/ /;
';

$sub .= '
	  print;
        }
';

#print $sub;die;
eval $sub;
