This is a discussion on How to grep the date range within the Shell scripting forums, part of the Development/Scripting category; How we can use the grep command to search for a particular date range e.g. need to grep the data ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| Sponsored Links | ||
|
|
|
|||
|
You can use sed to do that. You can't use a date/time range but you can specify the pattern. Assuming you data looks something like this...
Apr 25 something ... .. .... Apr 25 sss ww aa.... Apr 26...... . . . May 3 bbb ccc ddd... Code:
sed -n '/Apr 25/,/May 3/p' input_file |
|
|||
|
Hi
Thanks for ur reply but thr is sm method that i dont know suppose u want to grep frm 20 to 25th u can do easily using: grep -n "2[0-5]/April/2008" input_file but problem is if the month is different |
|
|||
|
Code:
egrep '((2[8-9]|3[0-1])/April|0[1-2]/May)/2008' logfile |
|
|||
|
1. egrep '(2[8-9]|3[0])/April/2008' server-81-access_log
If we try this command there will be no output. 2. egrep '(2[8-9]|3[0])/April/2008|0[1-2]/May/2008' server-81-access_log if we try this command there is output but for 1st n 2nd may only not for the april dates....... |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell date command for manipulation and formatting date | newbie4 | Shell scripting | 1 | 01-30-2008 01:21 PM |
| Grep ip address in Linux or UNIX | sweta | Getting started tutorials | 0 | 07-27-2007 06:47 AM |
| Linux sync. out of range monitor error | harshala09 | Linux hardware | 2 | 06-14-2007 09:37 AM |
| Grep and remove files | Linux software | 1 | 01-05-2006 06:25 PM | |