On Thu, 16 Nov 2000 08:10 Eric Clover wrote:
>hello,
>i have a need for something that will cat a large file, grep it for a
>word and have the ability to pull the 5 lines before and after (more
>like 3 lines before and 8 lines after) the grep has found the word and
>display the results.

According to the grep manpage:

       All variants of grep understand the following options:
       -A NUM, --after-context=NUM
              Print NUM lines of trailing context after  matching
              lines.
       -B NUM, --before-context=NUM
              Print  NUM lines of leading context before matching
              lines.
       -C [NUM], --context[=NUM]
              Print NUM lines (default 2) of output context.
       -NUM   Same as --context=NUM lines of leading and trailing
              context.   However, grep will never print any given
              line more than once.


-- 
Anthony E. Greene <[EMAIL PROTECTED]> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to