Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Closed Thread
  Search this Thread
Old 11-22-2009, 06:53 AM   #1
LQ Newbie
Registered: Oct 2008
Posts: 14

Rep: Reputation: 0
grep till second pattern


I want the lines upto the second occurance of a pattern to be printed.... i
know only till the first occurance....

i use awk '/pattern1/,/pattern2/' file

or sed -n '/pat1/,/pat2/p' file

I want all the lines from the start of the file till the second occurance of pattern called "Score"

Old 11-22-2009, 09:09 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Closed Thread

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
grep exact pattern kapila Linux - Newbie 11 08-06-2009 03:58 AM
grep lines between occurances of a pattern ksri07091983 Solaris / OpenSolaris 5 04-26-2009 07:14 AM
grep till the 1st occurrence of a pattern raghu123 Programming 2 04-15-2009 06:47 AM
grep till the 1st occurrence of a pattern raghu123 Programming 1 04-15-2009 06:17 AM
using grep when the pattern contains a ! farmerjoe Programming 9 03-16-2005 12:04 AM

All times are GMT -5. The time now is 01:58 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