#!/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; }