![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extracting text and reusing the text to rename file | JohnDS | UNIX for Dummies Questions & Answers | 7 | 02-05-2009 03:55 AM |
| Extracting a part of XML File | shridhard | Shell Programming and Scripting | 9 | 11-17-2008 07:41 AM |
| Extracting specific text from a file | rahulkav | Shell Programming and Scripting | 8 | 10-22-2008 11:34 AM |
| Extracting a line in a text file | terryporter51 | Shell Programming and Scripting | 5 | 10-13-2008 07:34 PM |
| extracting a set of strings from a text file | Deanne | Shell Programming and Scripting | 2 | 09-21-2007 12:31 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi guys
So I have a very large log file where each event is logged along with the time that it occurred. So for e.g. The contents of the file look like: Code:
... 12:00:07 event 0 happened. 12:01:01 event 1 happened. 12:01:05 event 2 happened. 12:01:30 event 3 happened. 12:02:01 event 4 happened. 12:02:40 event 5 happened. 12:03:40 event 6 happened. 12:04:06 event 6 happened. ... so some thing like all events between the first entry of 12:01:00 and the last entry of 12:03:59 and store them in a random text file. Note time stamps can be repeated and therefore I mentioned the first and the last entries. And not all lines in the log file start with a time stamp. Some lines are just random information about the server etc. But I want to extract those lines as well. Hope I have clarified my question. And thanks in advance every one ![]() ali Use CODE tags when posting code, data or logs for better readability and to preserve formatting like indention etc., ty. Last edited by zaxxon; 07-21-2009 at 12:25 PM.. Reason: code tags, what else |
|
||||
|
Or a nice simple grep would do it:
Code:
grep -E "12:01|12:02|12:03" <input_text_file_name> > <output_text_file_name> pSeries and AIX Information Center HTH |
|
||||
|
Quote:
Remember the requirement says: """And not all lines in the log file start with a time stamp. Some lines are just random information about the server etc. But I want to extract those lines as well.""" |
|
||||
|
Quote:
Code:
grep 12:0[1-3] event.log |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|