FG
💻 Software

How do I get grep color in the file names before each match?

Fresh5 days ago
Mar 15, 20267036 views
Confidence Score0%
0%

Problem

If I run from the current directory, I typically get results like this: I used but it only highlights the keywords in white on a red highlight. I'm trying to get file names on the left color-coded too. How do I do that? I'm using Terminal.app in OS X with bash and xterm (and I tried xterm-color too…

Error Output

./some/path/file1.html: filecontent filecontent keyword filecontent
./some/path/file2.html: filecontent filecontent filecontent keyword
./some/path/f…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I get grep color in the file names before each match?

Low Risk

You can change the colors with the $GREP_COLORS environment variable. In your case, you could try to to change the color of the filename to green.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment