99.60.97.205 - - [26/Mar/2011:06:00:00 +0000] GET /2009-03-29/world/impact.row.atlantic_1_rower-paul-ridley-cancer-research?_s=PM:WORLD HTTP/1.1 200 9386 www.abc.com Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 TCP_MISS Apache=- - 1068000 - - - deflate=- rmt=- 72.234.67.132 - - [26/Mar/2011:09:00:00 +0000] GET /ad-abc.php?f=medium_rectangle HTTP/1.1 200 869 www.abc.com Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.16) Gecko/20101130 Firefox/3.5.16 TCP_HIT Apache=- - 1000 - - - deflate=- rmt=- 68.12.178.167 - - [26/Mar/2011:09:00:00 +0000] GET /ad-feedback.js.php?e3e999d9b79cf36c165f5b379a0e9f269be82344 HTTP/1.1 200 600 www.abc.com Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) TCP_HIT Apache=- - 1000 - - - deflate=- rmt=- #### #!/usr/bin/perl use strict; use warnings; use Date::Manip; my $n="4"; my $date_converted = UnixDate(ParseDate("$n days ago"),"%e/%h/%Y"); open FILE,"> file.txt"; open DATA,"input.txt"; while(){ 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;