Xref: utzoo comp.unix.wizards:9391 comp.unix.questions:7607 Path: utzoo!attcan!uunet!yale!husc6!bu-cs!bzs From: bzs@bu-cs.BU.EDU (Barry Shein) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: Tool -flag considered harmful Message-ID: <23366@bu-cs.BU.EDU> Date: 15 Jun 88 15:12:09 GMT References: <7962@alice.UUCP> <4615@vdsvax.steinmetz.ge.com> <10989@cgl.ucsf.EDU> <23325@bu-cs.BU.EDU> <8090@brl-smoke.ARPA> Organization: Boston U. Comp. Sci. Lines: 41 In-reply-to: gwyn@brl-smoke.ARPA's message of 15 Jun 88 02:37:48 GMT From Doug Gwyn >In article <23325@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes: >>Another anti-filename:linenum argument is what if I want to limit the >>output to LESS than a single line, like printing only the exact text >>matched? &c. > >Hey, while we're at it, have an option to highlight the matched >pattern(s) in STANDOUT MODE (i.e. add control characters based on >getenv("TERM") or a -Tname option). You have to admit that would >sometimes be useful, and it depends even more than context on >what grep "has it's hands on". > >How far do you want to go with this? Doug, you've missed the point so completely it sends a shiver down my spine. The point is that if grep had a reasonable context-printer added everything I suggest would simply be doable with *that*, no options needed, while trying to build a back-end filter would probably be the thing demanding all the special cases since significant amounts of information have been lost once it went out the pipe. Besides, if the context printer were powerfully enough designed it could print STANDOUT mode with no mods, taking literal strings to echo should be natural enough: grep -P /\"^[[7m\"&/,/\"^[[0m\"/ pat file (-P start,end printing context, default is ".,.+1", syntax similar to ed) that is, & as in ed, \"..\" print (literally), the ANSI standout mode string, then the matched string, then the ANSI end-standout mode string. Tho it would be hardly necessary (better to backquote the grep into an xargs/echo), as was the criticism. A general purpose print specifier in grep could be a handy tool. -Barry Shein, Boston University