#!/usr/bin/perl -w use strict; use Text::CSV_XS; use IO::File; my $filename = "P:\\Program Files\\Exchsrvr\\DRACO.log\\20081116.log"; my $column_to_search = 18; my $wanted_value = 'Fw: Hey Ugly line expansion and re-offer'; my $csv = Text::CSV_XS->new ({sep_char => "\t"}); my $fh = IO::File->new($filename) or die $!; while (my $cols = $csv->getline($fh)) { last unless @$cols; next unless defined $cols->[$column_to_search] and $cols->[$column_to_search] eq $wanted_value; for (0,1,7) { $cols->[$_] = '' unless defined $cols->[$_]; } print join(' ',$cols->[0],$cols->[1],$cols->[7],$cols->[9],$cols->[13],$cols->[18],$cols->[19]),"\n"; } #### # Message Tracking Log File # Exchange System Attendant Version 6.5.7226.0 # Date Time client-ip Client-hostname Partner-Name Server-hostname server-IP Recipient-Address Event-ID MSGID Priority Recipient-Report-Status total-bytes Number-Recipients Origination-Time Encryption service-Version Linked-MSGID Message-Subject Sender-Address 2005-9-10 0:0:16 GMT - - - storming - Someoneg@aol.com 1027 2433A69xxxxxxxxxxxxxxxx795006DB02DADF78@storming.Domain.name1 0 0 11927 1 2005-9-10 0:0:16 GMT 0 - c=US;a= ;p=AMSCAN;l=storming-050910000016Z-212788 Fw: Hey Ugly line expansion and re-offer EX:/O=org/OU=Site/CN=RECIPIENTS/CN=Auser - 2005-9-10 0:0:16 GMT - - - storming - c1r3ai4g@aol.com 1019 2433A690xxxxxxxxxxxxxxxx5006DB02DADF78@storming.Domain.name1 0 0 11927 1 2005-9-10 0:0:16 GMT 0 - - Fw: Hey Ugly line expansion and re-offer - - 2005-9-10 0:0:16 GMT - - - storming - c1r3ai4g@aol.com 1025 2433A6xxxxxxxxxxxxxxxx95006DB02DADF78@storming.Domain.name1 0 0 11927 1 2005-9-10 0:0:16 GMT 0 - - Fw: Hey Ugly line expansion and re-offer - - 2005-9-10 0:0:16 GMT - - - storming - c1r3ai4g@aol.com 1024 2433A690Fxxxxxxxxxxxxxxxx6795006DB02DADF78@storming.Domain.name1 0 0 11927 1 2005-9-10 0:0:16 GMT 0 - - Fw: Hey Ugly line expansion and re-offer - - 2005-9-10 0:0:17 GMT - - - storming - c1r3ai4g@aol.com 1033 2433Axxxxxxxxxxxxxxxx428E5EE4C6795006DB02DADF78@storming.Domain.name1 0 0 11927 1 2005-9-10 0:0:16 GMT 0 - - Fw: Hey Ugly line expansion and re-offer Auser@Domain.name - 2005-9-10 0:0:17 GMT - - - storming - c1r3ai4g@aol.com 1020 2433A69xxxxxxxxxxxxxxxx95006DB02DADF78@storming.Domain.name1 0 0 11927 1 2005-9-10 0:0:16 GMT 0 - - Fw: Hey Ugly line expansion and re-offer Auser@Domain.name -