terminal - perl saving output of command with syntax highlighting -
I want to run a command in the terminal and capture the output so that I
my Output = `command`; The problem is that the highlighting syntax is in the command, then I print later, I loose the syntax highlighting and instead
Print $ output; Result
one ?? [31mArAà ¢ â,¬Ãƒâ € šÃ, €? [ How can I get commands without Syntax highlighting or somehow highlight syntax for display on a print. "post-text" itemprop = "text">
Try to escape ANSI color from shell output:
$ my output = `command `; My $ output = ~ s / \ e \ [[\ d;] * m / g; Print "$ Output", "\ n"; If you want to remove all ANSI escape-sequences, replace regexp with:
s / \ e [?. *? [\ @ - ~] // g
Comments
Post a Comment