Last active
September 28, 2017 19:42
-
-
Save DavidPesticcio/4246372962f5ee9c4677b961aacaff56 to your computer and use it in GitHub Desktop.
GREP: Customise the colour of matches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find GNU grep results quicker with a bit of colour! | |
http://www.arwin.net/tech/bash.php | |
https://linuxaria.com/pills/coloring-grep-to-easier-research | |
Add this to your shell customisations file with your choice of colours: | |
export GREP_OPTIONS='--color=auto' | |
export GREP_COLOR='1;31;44' | |
Choose your colours (Normal/Bright;Foreground;Background) | |
Brightness Normal Bright | |
0 1 | |
Color Foreground Background | |
Black 30 40 | |
Red 31 41 | |
Green 32 42 | |
Yellow 33 43 | |
Blue 34 44 | |
Magenta 35 45 | |
Cyan 36 46 | |
White 37 47 | |
Show all colour combinations hi/lo | |
for f in $(seq 0 1 7); do for b in $(seq 0 1 7); do for n in 0 1; do export GREP_COLOR=''${n}';3'${f}';4'${b}'' ; echo "GREP_COLOR='${n};3$f;4$b' - hello " | grep hello; done ; done ; echo ; done ; echo "export GREP_OPTIONS='--color=auto'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment