#!/usr/local/bin/perl # take a raptor log and remove unwanted tags # output will be in this order my @tags = qw( src= proto= arg= ); while (<>) { # if grep added filenames- chop them off if (/^logfile.*?:(.*)/) { ($line) = ($1) ; } else { ($line) = ($_) ; } # split based on any number of spaces my @fields = split (/ +/, $line); # month, date and time (add [3] if you want machinename) print ("@fields[0] @fields[1] @fields[2] "); foreach $tag (@tags) { foreach $thing (@fields) { if ( $thing =~ $tag ) { print ("$thing ") } } } print ("\n"); } exit 0;