On Wed, Jan 19, 2011 at 12:28:51AM -0500, David Kramer wrote: > > Upgrade fileutils. Newer versions of grep are much more configurable. > > I did some searching and was unable to find anything saying some version > of grep can colorize matches to different regexes with different colors. > Can you elaborate?
Well, I don't think it can quite do that... but, on my Ubuntu system: $ grep --version GNU grep 2.5.3 Copyright (C) 1988, 1992-2002, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ man grep [...] GREP_COLORS Specifies the colors and other attributes used to highlight various parts of the output. Its value is a colon-separated list of capabilities that defaults to ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36 with the rv and ne boolean capabilities omitted (i.e., false). Supported capabilities are as follows. [...] The capabilities allow for more than the simple colorization of the bits that match the regex that the old GREP_COLOR handles. The only way I can think of to do what you're describing is to write a wrapper around grep that can take multiple patterns and specify colors for each, and have the script run the grep commands separately, changing the value of GREP_COLORS in between each. This, of course, would give you the output all out of order, unless you told grep to give you the line numbers and sorted on those. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -=-=-=-=- This message is posted from an invalid address. Replying to it will result in undeliverable mail due to spam prevention. Sorry for the inconvenience.
_______________________________________________ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss