grep replacement

Brian Moffet brianm at sco.COM
Thu Jun 2 01:54:53 AEST 1988


In article <4537 at vdsvax.steinmetz.ge.com> barnett at vdsvax.steinmetz.ge.com (Bruce G. Barnett) writes:
>In article <1036 at cfa.cfa.harvard.EDU> wyatt at cfa.harvard.EDU (Bill Wyatt) writes:
>|grep '(your_pattern_here)' | head -1
>
>Or there are times when I want the first occurrence of a pattern from
>hundreds of files, but I don't want to see the pattern more than once.
>

Have you tried sed?  How about 

$ sed -n '/pattern/p;/pattern/q' file

???



-- 
Brian Moffet		brianm at sco.com  {uunet,decvax!microsof}!sco!brianm
The opinions expressed are not quite clear and have no relation to my employer.
'Evil Geniuses for a Better Tommorrow!'



More information about the Comp.unix.questions mailing list