grep replacement

Brandon S. Allbery allbery at ncoast.UUCP
Sun Jun 5 07:14:27 AEST 1988


As quoted from <2312 at bgsuvax.UUCP> by kutz at bgsuvax.UUCP (Kenneth Kutz):
+---------------
| In article <6866 at elroy.Jpl.Nasa.Gov>, alan at cogswell.Jpl.Nasa.Gov (Alan S. Mazer) writes:
| > One thing I would _love_ is to be able to find the context of what I've
| > found, for example, to find the two (n?) surrounding lines.  I have wanted
| > to do this many times and there is no good way.
+---------------

	grep -n foo ./bar | context 2

I posted context to net.sources back when it existed; someone may still have
archives from that time, if not I'll retrieve my sources and repost it.  It
takes lines of the basic form

	filename ... linenumber : ...

and displays context around the specified lines.  I use this with grep quite
often; it also works with cc (pcc, not Xenix cc) error messages.
-- 
Brandon S. Allbery			  | "Given its constituency, the only
uunet!marque,sun!mandrill}!ncoast!allbery | thing I expect to be "open" about
Delphi: ALLBERY	       MCI Mail: BALLBERY | [the Open Software Foundation] is
comp.sources.misc: ncoast!sources-misc    | its mouth."  --John Gilmore



More information about the Comp.unix.questions mailing list