Useful grep Flag

Paul Brown @ 2007-01-17T02:50:04Z

GNU grep supports a -A flag (or --after-context if you're a long options kind of person) that includes lines of context:

-A NUM, --after-context=NUM
       Print  NUM  lines  of  trailing  context  after  matching lines.
       Places  a  line  containing  --  between  contiguous  groups  of
       matches.

which is very handy for sifting through log files where you want grep to match the "ERROR" but the useful information is in the following couple of lines.

Meta

Tags: (tag) (tag)

(comment bubbles) 0 comments
381 direct views