Path: utzoo!attcan!uunet!husc6!bbn!uwmcsd1!ig!agate!ucbvax!decwrl!pyramid!prls!philabs!micomvax!cmtl01!mdorion From: mdorion@cmtl01.UUCP (Mario Dorion) Newsgroups: comp.unix.questions Subject: Re: grep replacement Message-ID: <319@cmtl01.UUCP> Date: 4 Jun 88 04:01:04 GMT References: <7882@alice.UUCP> <2450011@hpsal2.HP.COM> Organization: Frisco Bay Industries, Montreal Lines: 18 In article <2450011@hpsal2.HP.COM>, morrell@hpsal2.HP.COM (Michael Morrell) writes: > > (...) I'd like to see an option which ONLY prints the line > numbers where the pattern was found. > > Michael Morrell > hpda!morrell You could use the following: grep -n 'foo' bar | cut -d: -f1 -- Mario Dorion | ...!{rutgers,uunet,ihnp4}! Frisco Bay Industries | philabs!micomvax!cmtl01!mdorion Montreal, Canada | 1 (514) 738-7300 | I thought this planet was in public domain!