pulling info from files
I have a file that log certain events. I'd like to extract certain chunks of the file and redirect into a report. This command --
cat log.file|grep 'error'>report.error.log -- only pulls that exact line containing the error. But the preceeding and proceeding few lines are also important. Is there a way to 1)search the log for a certain string 2)print the preceeding 5 and proceeding 5 lines 3)similarly to the above, redirect output into a file ? Ideas? |
'man grep' says:
Code:
-A NUM, --after-context=NUM |
you're awesome. thanks.
|
All times are GMT -5. The time now is 09:23 AM. |