LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-14-2012, 03:37 PM   #1
mohitvad
Member
 
Registered: Feb 2010
Posts: 34

Rep: Reputation: 0
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 ?
 
Old 09-14-2012, 04:00 PM   #2
mohitvad
Member
 
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"
 
  


Reply



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 08: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 11:57 AM
start grep at line number secretlydead Linux - General 2 09-20-2007 06:03 AM
Grep pattern first line of a file ericcarlson Linux - Newbie 11 07-20-2004 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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