How to extract last week data from a log

HI,

I have a log file (sync.log) in the following format.

05-14 05:34:56 INFO Hxxx Start: Id:xxx
05-14 05:45:32 INFO Hxxx End: Id:xxxx
05-19 11:23:21 INFO Hxxx Start: Id:xxx
05-19 11:34:45 INFO Hxxx End: Id:xxxx
05-20 02:09:47 INFO Hxxx Start: Id:xxx
05-20 02:36:03 INFO Hxxx End: Id:xxx
05-22 08:11:55 INFO Hxxxx Start: Id :xxxx
05-22 08:35:55 INFO Hxxxx End: Id:xxxx

I want to extract only current week data. Please let me know how could i get it?

(`date`=Thu May 22) So..i have to get only data from 05-16 only.....)

Thanks,
Luv

Try omething on these lines...

sed -n "/start pattern/,/end pattern/p" file

Sorry..i did not get you..can you explanin indetail.

Luv

@praveenvi
Once you have the start and end pattern you can use sed or awk to print only records between pattern's.

To find the pattern's you should take a look over man date

Tip: To find the first date of this week use:

day_of_the_week=`date +%w`
day_of_the_month=`date +%d`
first_day_of_the_week=$((day_of_the_month - day_of_the_week))

Actually, i'm new to shell scripting ...i'm very confused with the syntax:

I would appriciate any of you could write the complete syntax(pattern's). Please do the needful.

Thanks

For Linux this should do the job.

awk 'substr($0,1,11) > start' start="`date --date="7 days ago" "+%m-%d"` 00:00" data.file