HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Showing results for 
Search instead for 
Did you mean: 

Search skills

Regular Advisor

Search skills


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

Feng Lin
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,

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,

James R. Ferguson
Acclaimed Contributor

Re: Search skills

Hi Feng:

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