1
0
Fork 0
dotfiles/.local/bin/escapefilter

11 lines
313 B
Perl
Executable File

#!/usr/bin/env perl
# this script should filter out any terminal escapes in a text stream
while (<>) {
s/ \e[ #%()*+\-.\/]. |
\e\[ [ -?]* [@-~] | # CSI ... Cmd
\e\] .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL)
\e[P^_] .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST
\e. //xg;
print;
}