LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   use grep to match multiple lines (https://www.linuxquestions.org/questions/linux-newbie-8/use-grep-to-match-multiple-lines-860404/)

noony123 02-03-2011 03:40 AM

use grep to match multiple lines
 
Hi all

I have done this before but i cant really recall now

I have a text file and i want to grep the word "interface" and 10 lines following it. I think there was some switch like grep -A or something ?? anyone knows ?

druuna 02-03-2011 03:41 AM

Hi,

Yep, -A10

Code:

grep -A10 "interface" infile
Hope this helps.

grail 02-03-2011 05:47 AM

Try looking at the man page.


All times are GMT -5. The time now is 06:38 AM.