I have a 500mb log file that I need to pull the backup info from. I need the date then the two lines to follow. Its also fine if the other days appear.

Fri Feb  8 00:00:02 2013
14:58:01  Level 0 Archive started on rootdbs, physdbs, logidbs, dbspace01
15:32:56  Archive on rootdbs, physdbs, logidbs, dbspace01 Completed.


  • 1
    It would probably help if you post some surrounding lines, so that posters can validate their regex – weeheavy Feb 12 '13 at 8:21
  • 1
    What's your end goal here? Are you trying to set up monitoring on whether your backups completed successfully? In any case, you really need to put full timestamps on every line in a log file. Relying on the context of surrounding lines is fraught with danger. – Ladadadada Feb 12 '13 at 9:15

Try grep -A2 "Fri Feb 8 00:00" /your/log/file

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.