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?
|