简体   繁体   English

如何在Perl中处理命令的彩色输出?

[英]How to handle colored output from command in perl?

I need to execute command from Perl script and print it's output, however command output is colored and Perl prints something like that: 我需要从Perl脚本执行命令并打印它的输出,但是命令输出是彩色的,Perl会打印类似的内容:

ESC[33m sample text ESC[m 

instead of coloring sample text . 而不是为sample text着色。

In other words: I want to know how to handle already colored input in Perl (not how to create colored output) 换句话说:我想知道如何在Perl中处理已经彩色的输入(而不是如何创建彩色的输出)

我会与开始colorstrip函数期限:: ANSIColor

uncolor 无色

uncolor takes input from files or standard input and returns in with colors and attributes stripped. uncolor从文件或标准输入中获取输入,并以去除颜色和属性的方式返回。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM