grep replacement (first occurence only)
JQ Johnson
jqj at uoregon.uoregon.edu
Tue May 31 08:00:44 AEST 1988
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.
More information about the Comp.unix.questions
mailing list