QuestionQ80

VerifiedGNU and Unix Commands

Given a loga.log file whose timestamps use the format DD/MM/YYYY:hh:mm:ss, which command filters all log entries occurring between 8:00 am and 8:59 am?

Explanation

The time range from 8:00 am through 8:59 am has an hour field of 08. In an extended regular expression, :08:[0-9]+:[0-9]+ matches that hour followed by numeric minute and second fields, and grep -E applies the pattern to loga.log.

Community Discussion

No comments yet. Be the first to start the discussion!