Xref: utzoo comp.unix.wizards:8973 comp.unix.questions:7324 Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!rochester!cornell!batcomputer!itsgw!steinmetz!vdsvax!barnett From: barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: grep replacement Message-ID: <4537@vdsvax.steinmetz.ge.com> Date: 31 May 88 12:43:56 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> Reply-To: barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) Organization: General Electric CRD, Schenectady, NY Lines: 25 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 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 uunet!steinmetz!barnett