Xref: utzoo comp.unix.wizards:8989 comp.unix.questions:7336
Path: utzoo!attcan!uunet!mcvax!aeb
From: aeb@cwi.nl (Andries Brouwer)
Newsgroups: comp.unix.wizards,comp.unix.questions
Subject: Re: grep replacement
Message-ID: <7560@boring.cwi.nl>
Date: 31 May 88 18:27:49 GMT
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>
Organization: CWI, Amsterdam
Lines: 14

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

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@cwi.nl