#!/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"; }