Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ucdavis!sunny!poage From: poage@sunny.ucdavis.edu (Tom Poage) Newsgroups: comp.unix.questions Subject: Quit on match Summary: Re: Why does pipeline work this way? Keywords: pipeline, grep | cat Message-ID: <428@sunny.ucdavis.edu> Date: 18 Dec 89 23:31:34 GMT References: <10064@saturn.ucsc.edu> <1989Dec16.133416.3855@virtech.uucp> Reply-To: poage@sunny.ucdavis.edu (Tom Poage) Distribution: na Organization: UCDMC Clinical Engineering, Sacto., CA Lines: 25 In article <1989Dec16.133416.3855@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes: ... >If you really want this functionality, get the gnu grep sources and add >a parameter to stop looking after the first match (i.e. only show the >first matching record). Or you could make it reall inefficient and turn >off all buffering, but I don't recommend this. >-- >+-----------------------------------------------------------------------+ >| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! >| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | >+-----------------------------------------------------------------------+ Alternatively, try sed -n '/pattern/{ p q }' filename The matching line is printed immediately since output is flushed on close. Tom. -- Tom Poage, Clinical Engineering Universiy of California, Davis, Medical Center, Sacramento, CA poage@sunny.ucdavis.edu {...,ucbvax,uunet}!ucdavis!sunny!poage