Live Chat!

grep for a few lines

          0 votos

September 15th, 2006 mysurface Posted in Text Manipulation, grep | Hits: 1246 |

One of the useful option for grep, when you find the keyword you are searching, instead of return a particular line that contains the keyword, it allows you to specified how many lines to return by specified -A option.

Let say I want to return 5 lines when i found “main” at hello.c.

grep -A 5 main hello.c

Leave a Reply