Commit | Line | Data |
---|---|---|
a63343a0 | 1 | #!/usr/bin/env perl |
4e2acbd1 | 2 | # DO NOT USE. See README |
a63343a0 AR |
3 | ## uncolor ? remove terminal escape sequences such as color changes |
4 | ## Source: https://unix.stackexchange.com/questions/14684/removing-control-chars-including-console-codes-colours-from-script-output by Gilles | |
5 | while (<>) { | |
6 | s/ \e[ #%()*+\-.\/]. | | |
7 | \e\[ [ -?]* [@-~] | # CSI ... Cmd | |
8 | \e\] .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL) | |
9 | \e[P^_] .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST | |
10 | \e. //xg; | |
11 | print; | |
12 | } |