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