grep replacement (first occurence only)

John F. Haugh II jfh at rpp386.UUCP
Thu Jun 2 03:57:15 AEST 1988


In article <2117 at uoregon.uoregon.edu> jqj at drizzle.UUCP (JQ Johnson) writes:
>In article <1036 at cfa.cfa.harvard.EDU> wyatt at 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 at rpp386.uucp          | 



More information about the Comp.unix.wizards mailing list