#!/usr/bin/perl
use strict;
use warnings;
use Date::Manip;
my $date_converted = UnixDate(ParseDate("3 days ago"),"%e/%h/%Y");
open FILE,">$ARGV[0]";
while(<DATA>){
my @tab_delimited_array = split(/\t/,$_);
$tab_delimited_array[3] =~ s/^\[//;
$tab_delimited_array[3] =~ s/^\-//;
my $converted_date = Date_ConvTZ( UnixDate($tab_delimited_array[3],"%Y%m%d%H:%M:%S"),'GMT','PST');
my $pst_converted_date = UnixDate($converted_date,"%e/%h/%Y:%H:%M:%S");
$pst_converted_date =~ s/^\s//g;
my $extracted_YMD=UnixDate($converted_date,"%e/%h/%Y");
if($extracted_YMD =~ m/$date_converted/){
print FILE $_;
}
}
close FILE;
close DATA;
__DATA__
66.249.65.43 www.cabc.com - 3/Jul/2010:19:00:01 +0000 "GET http://www.abc.com HTTP/1.1" 200 0.730 7362 0 0 - - Mozilla/5.0+(compatible;+Googl/2.1;+\+http://www.google.com/bot.html) TCP_MISS
66.249.65.43 www.cabc.com - 4/Jul/2010:19:00:01 +0000 "GET http://www.abc.com HTTP/1.1" 200 0.730 7362 0 0 - - Mozilla/5.0+(compatible;+Googl/2.1;+\+http://www.google.com/bot.html) TCP_MISS
66.249.65.43 www.cabc.com - 2/Jul/2010:09:00:01 +0000 "GET http://www.abc.com HTTP/1.1" 200 0.730 7362 0 0 - - Mozilla/5.0+(compatible;+Googl/2.1;+\+http://www.google.com/bot.html) TCP_MISS
66.249.65.43 www.cabc.com - 3/Jul/2010:09:00:01 +0000 "GET http://www.abc.com HTTP/1.1" 200 0.730 7362 0 0 - - Mozilla/5.0+(compatible;+Googl/2.1;+\+http://www.google.com/bot.html) TCP_MISS
---------- Post updated at 02:26 AM ---------- Previous update was at 02:25 AM ----------
The file is very large and it takes long time to execute.
The input is tab delimited file