Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-14-2012, 04:37 PM   #1
Registered: Feb 2010
Posts: 34

Rep: Reputation: 0
grep with pattern and line number


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 $?

Can any body help to correct the syntax to find the pattern that starts with or any alter command ?
Old 09-14-2012, 05:00 PM   #2
Registered: Feb 2010
Posts: 34

Original Poster
Rep: Reputation: 0
No issue found with the syntax. it was fine but the file was not having anything that starts with the word "app"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to extract a 2-line pattern from a file using awk, grep, etc. dcsmayei Linux - Newbie 9 06-09-2012 09:32 AM
I want to print a line if i dont find the pattern using grep.! how is this possible? ameylimaye Linux - Newbie 4 09-28-2011 12:57 PM
start grep at line number secretlydead Linux - General 2 09-20-2007 07:03 AM
Grep pattern first line of a file ericcarlson Linux - Newbie 11 07-20-2004 11:51 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration