cancel
Showing results for 
Search instead for 
Did you mean: 

Search skills

Fenglin
Regular Advisor

Search skills

Hi

I have a file which contains the daily logs from time 0000 to 2359hrs for a single day. How to retrieve only those 1400 to 1500?

Inside the log, you will see, for example, Jul 2 00:00:00 to Jul 2 23:59:59

Thanks
Feng Lin
3 REPLIES
Ganesan R
Honored Contributor

Re: Search skills

Hi Fenglin,

What simple grep returns?

#grep "14:*"

This should return the entries from 14:00:00 to 14:59:59 from the log file
Best wishes,

Ganesh.
Ganesan R
Honored Contributor

Re: Search skills

Hi again,

If the log file contains more than one day entry, then use like this..

#grep "Jul 2 14:*"

Note the space is important as it appear inside the log file.
Best wishes,

Ganesh.
James R. Ferguson
Acclaimed Contributor

Re: Search skills

Hi Feng:

# grep -E "14:[0-5][0-9]:" log

Regards!

...JRF...