Xref: utzoo comp.unix.wizards:9147 comp.unix.questions:7450 Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!osu-cis!killer!vector!rpp386!jfh From: jfh@rpp386.UUCP (John F. Haugh II) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: grep replacement (first occurence only) Message-ID: <2279@rpp386.UUCP> Date: 1 Jun 88 17:57:15 GMT Article-I.D.: rpp386.2279 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: jfh@rpp386.UUCP (The Beach Bum) Organization: Big "D" Home for Wayward Hackers Lines: 23 In article <2117@uoregon.uoregon.edu> jqj@drizzle.UUCP (JQ Johnson) writes: >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. there is a boyer/moore based fast grep in the archives. adding an additional option (say '-f' for first in each file?) should be quite simple. perhaps i'll post the diff's if i remember to go hack on the sucker any time soon. - joh. -- John F. Haugh II | "If you aren't part of the solution, River Parishes Programming | you are part of the precipitate." UUCP: ihnp4!killer!rpp386!jfh | -- long since forgot who DOMAIN: jfh@rpp386.uucp |