![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HOW to egrep fo a pattern | eliewadi | Shell Programming and Scripting | 1 | 05-15-2008 07:42 PM |
| nawk-how count the number of occurances of a pattern, when don't know the pattern | cyber111 | Shell Programming and Scripting | 2 | 05-11-2008 12:00 AM |
| Egrep cheat sheet anywhere? Looking for meaning of egrep -c | leelm | UNIX for Dummies Questions & Answers | 2 | 01-11-2008 11:37 AM |
| Pattern searching pattern in c files | murthybptl | Shell Programming and Scripting | 6 | 11-17-2007 05:15 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 11:41 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
egrep a certain pattern
hey guys this is my first post here, heard a lot about these forums. Iam urgently in need of a command which would help me accomplish the following , for example a file has these contents:
211 61 2007-06-26 13:47:32 211 61 2007-06-26 09:53:43 211 61 2007-06-26 15:25:14 211 61 2007-06-26 04:32:11 211 61 2007-06-26 21:12:36 211 61 2007-06-26 02:11:27 now , i need to EGREP a pattern which would give me the following output: 211 61 2007-06-26 13 211 61 2007-06-26 09 basically, all lines are same.. what i need to EGREP is in each line "the range of grepping would be from 211 to hours i.e 00,12,09 etc. egrep -e "211 2007-06-26 $$" ?? date is fine ,everything is same..i just need to know the command which would grep me the contents uptil the 2 digits of HOURS. urgent reply needed!! thanks! |
| Forum Sponsor | ||
|
|
|
|||
|
hello !
by two digits i mean 13:47:56 14:11:21: basically 13 and 14 are the 2 digits i need an output which would begin from 211 and end on the 2 digits of the hours , e.g. following is what i desire as a result: 211 61 2007-06-26 13 211 61 2007-06-26 09 211 61 2007-06-26 01 211 61 2007-06-26 00 211 61 2007-06-26 12 211 61 2007-06-26 06 so u see it is showing 2 digits of hours, no minutes or seconds after that. basically this is a 300 mb text file which is showing 211 61 transactions with date and time i need to know the command so it can show uptil HOURS only (no minutes or seconds) so i can see which transaction is made at what hour (no minutes or seconds) |
|
|||
|
wow thanks a lot anbu23!!!!!
now iam facing another problem ok for example i need to grep only the transaction of 14th hour i will do this: cut -d':' -f1 filename|grep "14" it will show: 211 61 2007-06-26 14 211 61 2007-06-26 14 211 61 2007-06-26 14 211 61 2007-06-26 14 now what if i need to see the files which are of 00 hour?? cut -d':' -f1 filename|grep "00" if i do this it will show all the files because 2007 also has two zeros. |