Path: utzoo!attcan!uunet!husc6!rutgers!tut.cis.ohio-state.edu!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon S. Allbery) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: grep replacement Message-ID: <7954@ncoast.UUCP> Date: 12 Jun 88 22:30:23 GMT References: <136@rubmez.UUCP> <449@happym.UUCP> <7944@alice.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 32 Xref: utzoo comp.unix.wizards:9274 comp.unix.questions:7537 As quoted from <7944@alice.UUCP> by andrew@alice.UUCP: +--------------- | the right thing to do is to write a context program that takes | input looking like "filename:linenumber:goo" and prints whatever context you like. | we can then take this crap out of grep and diff and make it generally available | for use with programs like the C compiler and eqn and so on. It can also do | the right thing with folding together nearby lines. At least one good first | cut has been put on the net but a C program sounds easy enough to do. +--------------- A C version has been done; it handles pcc, grep -n, and cpp messages. I posted it 2 1/2 years ago. It does *not* handle diff, since diff's messages are slightly different and lack filename information; also, since it passes lines it doesn't understand you'd end up with both regular and context diffs in the same output. Now if diff had an option to output in the format :[-]: we'd be all set -- I could modify it to handle ranges easily. (Changes would be output as "file1:n-m:file was\nfile2:n-m:now is", or something similar.) Note that it'd be nice if lint output messages this way as well. I have a postprocessor for lint which does this -- even with System V's lint that can have lint1 and lint2 run separately via .ln files. -- 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