Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show data in logfile between certain date/time

Status
Not open for further replies.

btinder

Programmer
Mar 12, 2004
27
US
Hi there,

Our system has a logfile that is generated for an application when it starts and completes.

The format of the date/time is:

DD-MMM-YY@HH:MM:SS <msg>

example:
20-May-04@18:00:00 Started

I want to write a script that will display the logfile from a certain time to the same time within a 24 hour period.

For example: I have an application that starts at 21:15 every night, I would like to display all of the data in the logfile from 19-May-04 21:15:00 to 20-May-04 21:15:00..

Any good hints/tips on how to do this? Thanks so much for any help!
 
Something like this ?
awk '/^19-May-04@21:15/,/^20-May-04@21:15/' /path/to/logfile

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top