grep replacement
Bruce G. Barnett
barnett at vdsvax.steinmetz.ge.com
Tue May 31 22:43:56 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
Yes I have tried that. You are missing the point.
Have you ever waited for a computer?
There are times when I want the first occurrence of a pattern without
reading the entire (i.e. HUGE) file.
Or there are times when I want the first occurrence of a pattern from
hundreds of files, but I don't want to see the pattern more than once.
And yes I know how to write a shell script that does this.
IMHO (sarcasm mode on), it is more efficient to call grep
once for one hundred files, than to call (grep $* /dev/null|head -1)
one hundred times.
--
Bruce G. Barnett <barnett at ge-crd.ARPA> <barnett at steinmetz.UUCP>
uunet!steinmetz!barnett
More information about the Comp.unix.questions
mailing list