Xref: utzoo comp.unix.wizards:8988 comp.unix.questions:7334 Path: utzoo!attcan!uunet!husc6!mailrus!ames!ucsd!ucsdhub!hp-sdd!hplabs!hp-pcd!uoregon!jqj From: jqj@uoregon.uoregon.edu (JQ Johnson) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: grep replacement (first occurence only) Message-ID: <2117@uoregon.uoregon.edu> Date: 30 May 88 22:00:44 GMT References: <7882@alice.UUCP> <5630@umn-cs.cs.umn.edu> <6866@elroy.Jpl.Nasa.Gov> <4524@vdsvax.steinmetz.ge.com> <1036@cfa.cfa.harvard.EDU> Reply-To: jqj@drizzle.UUCP (JQ Johnson) Organization: University of Oregon, Computer Science, Eugene OR Lines: 9 In article <1036@cfa.cfa.harvard.EDU> wyatt@cfa.harvard.EDU (Bill Wyatt) writes: > >> There have been times when I wanted a grep that would print out the >> first occurrence and then stop. >grep '(your_pattern_here)' | head -1 This is, of course, unacceptable if you are searching a very long file (say, a census database) and have LOTS of pipe buffering. Too bad it isn't feasible to have a shell that can optimize pipelines.