Created
September 27, 2021 13:35
-
-
Save Khoulaiz/cb2f58374281e0485d2445ebbc796108 to your computer and use it in GitHub Desktop.
Removes ansi stuff from a text
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
#!/usr/bin/env perl | |
## 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment