11 lines
389 B
Perl
Executable file
11 lines
389 B
Perl
Executable file
#!/usr/bin/env perl
|
|
## https://stackoverflow.com/questions/17998978/removing-colors-from-output
|
|
## uncolor — remove terminal escape sequences such as color changes
|
|
while (<>) {
|
|
s/ \e[ #%()*+\-.\/]. |
|
|
\e\[ [ -?]* [@-~] | # CSI ... Cmd
|
|
\e\] .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL)
|
|
\e[P^_] .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST
|
|
\e. //xg;
|
|
print;
|
|
}
|