grep replacement

Andries Brouwer aeb at cwi.nl
Wed Jun 1 04:27:49 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

A fast way of searching for the first occurrence is really useful.
I have a version of grep called `contains', and a shell script
for formatting that says: if the input contains .[ then use refer;
if it contains .IS then ideal; if .PS then pic; if .TS then tbl, etc.

-- 
      Andries Brouwer -- CWI, Amsterdam -- uunet!mcvax!aeb -- aeb at cwi.nl



More information about the Comp.unix.questions mailing list