Skip to content

Instantly share code, notes, and snippets.

@guilhermechapiewski
Created February 5, 2011 05:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilhermechapiewski/812233 to your computer and use it in GitHub Desktop.
Save guilhermechapiewski/812233 to your computer and use it in GitHub Desktop.
"tail -f" a log archive with colored output
#!/bin/bash
# Usage: colored_tail.sh [logfile]
tail -f ${1} | perl -pe 's/^\[DEBUG\].*$/\e[35m$&\e[0m/g;s/^\[INFO\].*$/\e[36m$&\e[0m/g;s/^\[WARN\].*$/\e[33m$&\e[0m/g;s/^\[ERROR\].*$/\e[31m$&\e[0m/g;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment