Xref: utzoo comp.unix.wizards:9523 comp.unix.questions:7686 Path: utzoo!attcan!uunet!husc6!mailrus!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: <8167@ncoast.UUCP> Date: 19 Jun 88 14:13:41 GMT References: <7962@alice.UUCP> <5826@umn-cs.cs.umn.edu> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 42 As quoted from <5826@umn-cs.cs.umn.edu> by randy@umn-cs.cs.umn.edu (Randy Orrison): +--------------- | In article <7962@alice.UUCP> andrew@alice.UUCP writes: | |3) print lines with context. | | the second most requested feature but i'm not doing it. this is | | just the job for sed. to be consistent, we just took the context | ^^^^^^^^^^^^^^^^ | | crap out of diff too. this is actually reasonable; showing context | ^^^^^^^^^^^^^^^^ | | is the job for a separate tool (pipeline difficulties apart). | | | What?!?!? Ok, i would like context in grep, but i'll live without it. | Context diffs, however are a different matter. There isn't an easy way | to generate them with diff/context (the first character of every line is | produced as part of the diff). Context diffs are useful for patches, and +--------------- Yes, there is; change diff's output format slightly and expand "context" slightly, then other programs can also output in "extended context" format so as to use "context"'s facilities. I've already described part of this change in another posting; the other part would be to recognize a special indicator (on the line number, perhaps?) which would for generality be the flag to use on the difference, defaulting to "*" which is what "context" currently uses, or diff could specify "+", "-", or "!". The only other change would be to smarten "context" so that it "collapses" context "windows" together much like the 4.3BSD diff -c does. It appears that Bell Labs continues to use tools unrepentantly. It should be noted that they *are* into research, so I have no arguments against their use of /dev/stdin (/dev/fd/0?), their assumption that there's plenty of space so stash away a copy of a file with "tee" for later use in "context", etc. (My /dev/stdin complaint earlier was not aimed at the Bell Labs folks, it was aimed at the person who informed the entire Usenet that "hey, I posted a /dev/stdin driver source for 4.2BSD, so not a one of you has any reason not to be running it". In other words, the usual 4.xBSD-source elitism.) -- 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