Path: utzoo!attcan!uunet!mcvax!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.unix.wizards Subject: Re: grep replacement Message-ID: <515@philmds.UUCP> Date: 20 Jun 88 19:07:52 GMT References: <16174@brl-adm.ARPA> Reply-To: leo@philmds.UUCP (L.J.M. de Wit) Organization: Philips I&E DTS Eindhoven Lines: 27 In article <16174@brl-adm.ARPA> rbj@cmr.icst.nbs.gov (Root Boy Jim) writes: == From: andrew@alice.uucp == == 4) print one(first matching) line and go onto the next file. == most of the justification for this seemed to be scanning == mail and/or netnews articles for the subject line; neither == of which gets any sympathy from me. but it is easy to do == and doesn't add an option; we add a new option (say -1) == and remove -s. -1 is just like -s except it prints the matching line. == then the old grep -s pattern is now grep -1 pattern > /dev/null == and within epsilon of being as efficent. == =I often grep for a host name in /etc/hosts. This is a big file and =would benefit from the execution time saved. Yeah, I know, use sed, =it's only one file. OK, how about this: grep -1 '#include .thing.' *.c? I think sed could do the trick if we would allow a new command for it: S: skip to the next file. It should be very easy to implement and obviously satisfies a need (looking at the response of the net). Somewhat for the next net pollution: sed replacement ;-) Leo. Sed fugit interea, fugit | But in the meantime flies, flies the irreparabile tempus. | irreparable time. | VERGILIUS, Gregorica 3. 284