LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grep with pattern and line number (https://www.linuxquestions.org/questions/linux-newbie-8/grep-with-pattern-and-line-number-4175427304/)

mohitvad 09-14-2012 03:37 PM

grep with pattern and line number
 
Hi,

I want to grep the patteren that starts with some name. if it matches then print next 7 lines.

Working fine if i use the below syntax
# grep -A 7 app /tmp/wiki

Not working if i grep the pattern that starts with
# grep -A 7 "^app" /tmp/wiki
# echo $?
1


Can any body help to correct the syntax to find the pattern that starts with or any alter command ?

mohitvad 09-14-2012 04:00 PM

No issue found with the syntax. it was fine but the file was not having anything that starts with the word "app"


All times are GMT -5. The time now is 09:48 AM.