unixgreprhel5

GREP_COLOR doesn't work on camelcase


I work connected to a grid running RHEL 5.7 and it has grep 2.5.1 available. I have configured a GREP_COLOR variable to highlight matches in green and alias grep = "grep --color -nri".

It works fine but when I try to search for a camelcase text, the color highlighting doesn't work and it outputs everything on white letters. But if I put the same text all in lowercase it is highlighted (-i flag works).

Does anyone knows why should this happen?

Thanks !


Edit: To be more explicit here is an example:

On my .bashrc I have this :

export GREP_COLOR='01;33'
alias grep="grep --color -nri"

If I try to find a text like 'someTestExample' in the current directory and its children:

$ grep 'someTestExample' . #returns what it found without highlighting 
$ grep 'sometestexample' . #highlighted output

screenshot


Solution

  • This apparently is a bug related to the -i flag. When I removed it from my alias the camelCase highlighting works as it should.

    As the grep version I'm using is pretty old, probably on newer version this is already fixed.

    So, the way I fixed this is removing the -i flag from my alias.