data extract from dates

I have a 1 GB file.I want to take the information for last one month from that file.

Say i want to extract data from May 1st.

File contents below.

193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/notification.htm HTTP/1.1" 200 38531
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /images/2_aca_fai.gif HTTP/1.1" 200 833
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/arrow16.gif HTTP/1.1" 200 920
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/pdf.gif HTTP/1.1" 200 1691
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/ppt.gif HTTP/1.1" 200 189
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/vendorid.gif HTTP/1.1" 304 0
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /images/spm_secured.gif HTTP/1.1" 200 60319
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/word.gif HTTP/1.1" 200 193
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/faicontactinfo.JPG HTTP/1.1" 200 50520
193.135.218.124 - - [19/May/2009:01:42:09 -0700] "GET /jsp/acafai/supplier/editfai.JPG HTTP/1.1" 200 43789
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/FAI%20Attachement.jpeg HTTP/1.1" 200 26810
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/TotalFAISubApr2009.JPG HTTP/1.1" 200 62144
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/FAIbyDispApr2009.JPG HTTP/1.1" 200 61998
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/TotalFAISubMar2009.JPG HTTP/1.1" 200 44410
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/FAIbyRejApr2009.JPG HTTP/1.1" 200 48146
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/FAIbyRejMar2009.JPG HTTP/1.1" 200 51507
193.135.218.124 - - [19/May/2009:01:42:10 -0700] "GET /jsp/acafai/supplier/FAIbyDispFeb2009.JPG HTTP/1.1" 200 41910

Have you tried grep?

Hi,

Say i want report starting mar to June.

How will i grep.I can grep if i require for one month.I want collect the data for last 3 months and redirect to a file means how can i do that?

Use multiple search patterns:

grep -e Mar -e Apr -e May "$file"

Also note that grep's cousin "egrep" allows you to use extended regular expressions in your search pattern. So for 3 months, you could do -

$
$ cat months.txt
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
$
$ egrep "Mar|Apr|May" months.txt
Mar
Apr
May
$
$

Search the Internet for the "grep family" of commands.

tyler_durden

The "grep family" is deprecated; egrep has been replaced by grep -E, and fgrep has been replaced by grep -F.