Skip to content

Instantly share code, notes, and snippets.

@ElMesa
Forked from masonwan/grep-color.sh
Last active September 3, 2021 19:37
Show Gist options
  • Select an option

  • Save ElMesa/374c556283972e96deef to your computer and use it in GitHub Desktop.

Select an option

Save ElMesa/374c556283972e96deef to your computer and use it in GitHub Desktop.
Colorize logs
tail -200 catalina.out | \
ack-grep --flush --passthru --color --color-match=red "^.*ERROR.*" | \
ack-grep --flush --passthru --color --color-match=green "^.*DEBUG.*" | \
ack-grep --flush --passthru --color --color-match=blue "^.*INFO.*"
####################################################################
# Colors available
#
# From Stackoverflow: http://stackoverflow.com/a/9626444
# Thanks to Andy Lester: http://stackoverflow.com/users/8454/andy-lester
# Thanks to Mytho: http://stackoverflow.com/users/225037/mytho
####################################################################
#The recognized normal foreground color attributes (colors 0 to 7) are:
#
# black red green yellow blue magenta cyan white
#
# The corresponding bright foreground color attributes (colors 8 to 15)
# are:
#
# bright_black bright_red bright_green bright_yellow
# bright_blue bright_magenta bright_cyan bright_white
#
# The recognized normal background color attributes (colors 0 to 7) are:
#
# on_black on_red on_green on_yellow
# on_blue on_magenta on_cyan on_white
#
# The recognized bright background color attributes (colors 8 to 15) are:
#
# on_bright_black on_bright_red on_bright_green on_bright_yellow
# on_bright_blue on_bright_magenta on_bright_cyan on_bright_white
#
# For any of the above listed attributes, case is not significant
####################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment