Skip to content

Instantly share code, notes, and snippets.

@pfultz2
Created July 17, 2015 22:53
Show Gist options
  • Save pfultz2/c008f1a57665ac426833 to your computer and use it in GitHub Desktop.
Save pfultz2/c008f1a57665ac426833 to your computer and use it in GitHub Desktop.
Colorize gcc output
#!/bin/bash
while read x ; do echo $x ; done \
| sed -e "s/.*error:.*/\x1b[1;36m&\x1b[0m/" \
-e "s/.*warning:.*/\x1b[1;36m&\x1b[0m/" \
-e "s/^\(.*\)\(required from\)/\x1b[1;36m\1\x1b[0mnote: \2/" \
-e "s/^\(.*\)\(In instantiation of\)/\x1b[1;36m\1\x1b[0mnote: \2/" \
-e "s/^\(.*\)\(In member\)/\x1b[1;36m\1\x1b[0mnote: \2/" \
| sed -e "s/error:/\x1b[1;31m&\x1b[1;36m/" \
-e "s/warning:/\x1b[1;35m&\x1b[1;36m/" \
-e "s/note:/\x1b[1;30m&\x1b[0m/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment