finish deprecation of old libremanage command
[libremanage.git] / libremanage-uncolor
1 #!/usr/bin/env perl
2 # DO NOT USE. See README
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 }