Xref: utzoo comp.unix.wizards:8967 comp.unix.questions:7320 Path: utzoo!yunexus!maccs!dan From: dan@maccs.UUCP (Dan Trottier) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: grep replacement Message-ID: <1214@maccs.UUCP> Date: 31 May 88 13:13:16 GMT Article-I.D.: maccs.1214 Posted: Tue May 31 09:13:16 1988 References: <7882@alice.UUCP> <5630@umn-cs.cs.umn.edu> <6866@elroy.Jpl.Nasa.Gov> <1036@cfa.cfa.harvard.EDU> <8077@elsie.UUCP> Reply-To: dan@maccs.UUCP (Dan Trottier) Organization: McMaster U., Hamilton, Ont., Can. Lines: 19 In article <8077@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) 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 > >Doesn't cut it for > > grep '(your_pattern_here)' firstfile secondfile thirdfile ... This is getting ridiculous and can be taken to just about any level... foreach i (file1 file2 ...) grep 'pattern' $i | head -1 end -- A.I. - is a three toed sloth! | ...!uunet!mnetor!maccs!dan -- Official scrabble players dictionary -- | dan@mcmaster.BITNET