Skip to content

Instantly share code, notes, and snippets.

@dlfinis
Created March 25, 2019 16:34
Show Gist options
  • Save dlfinis/90ed54bdcc31ba544b494f2a6241fef1 to your computer and use it in GitHub Desktop.
Save dlfinis/90ed54bdcc31ba544b494f2a6241fef1 to your computer and use it in GitHub Desktop.
Complete read of a file with tail and color
#!/bin/sh
tail -f ${@:1} | sed --unbuffered \
-e 's/\(.*INFO.*\)/\o033[90m\1\o033[39m/' \
-e 's/\(.*NOTICE.*\)/\o033[37m\1\o033[39m/' \
-e 's/\(.*WARNING.*\)/\o033[33m\1\o033[39m/' \
-e 's/\(.*ERROR.*\)/\o033[93m\1\o033[39m/' \
-e 's/\(.*CRITICAL.*\)/\o033[31m\1\o033[39m/' \
-e 's/\(.*ALERT.*\)/\o033[91m\1\o033[39m/' \
-e 's/\(.*EMERGENCY.*\)/\o033[95m\1\o033[39m/' \
-e 's/\(\#.*\)/\o033[90m\1\o033[39m/' \
-e 's/\(stacktrace\)/\o033[37m\1\o033[39m/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment