Tool -flag considered harmful

Barry Shein bzs at bu-cs.BU.EDU
Thu Jun 16 01:12:09 AEST 1988


>From Doug Gwyn
>In article <23325 at bu-cs.BU.EDU> bzs at 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



More information about the Comp.unix.wizards mailing list