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
#!/bin/sh | |
# Strip color codes from Rails logs | |
# Examples: | |
# stripcolor test.log > test.log.nocolor # Save a copy of the log without color | |
# stripcolor test.log | gist # Gist the log | |
# stripcolor test.log | pbcopy # Copy the log to the clipboard in OSX | |
# stripcolor test.log | xclip -selection clipboard # Copy log to clipboard in Linux | |
cat "$@" | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" |