In comp.editors, Eric Pement <
eric....@gmail.com> wrote:
> On Friday, June 1, 2012 1:57:47 AM UTC-5, Tim Roberts wrote:
>> nicky <
nicolas_l...@hotmail.com> wrote:
>>> I would like to create a grep to be able to colorize and
>>> indent phrases in this way. Is it possible to do that in grep ?
>> Grep doesn't do that. Grep searches through files and prints the lines
>> that contain the search phrase.
>> However, I suspect you didn't really mean "grep" here.
> No, I think he really did mean grep, but he was referring to GNU grep.
That's ggrep, then. Seriously, there are a lot of versions of grep,
and they each have different functionality. /usr/bin/grep on Solaris
is nothing like /usr/bin/grep on Ubuntu.
Well, for some values of "nothing" at least.
> Try this command to see it with GNU grep:
>
> echo hello | grep --color=always "he"
echo hello | ggrep --color=always "he"
^[[01;31m^[[Khe^[[m^[[Kllo
Charming, ain't it. And near as I can tell, gnu grep will identify
all intra-line matches for coloring, but doesn't have an option to
print the total number of matches, just the posix "-c" which prints
number of lines with matches. A victory of gloss over substance.
ObEditors:
:set hlsearch
turns on a similar coloring thing in vim
Elijah
------
does not use colors in ggrep or vim