grep replacement

Leo de Wit leo at philmds.UUCP
Tue Jun 21 05:07:52 AEST 1988


In article <16174 at brl-adm.ARPA> rbj at cmr.icst.nbs.gov (Root Boy Jim) writes:
== From: andrew at 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



More information about the Comp.unix.wizards mailing list