How to remove the decorate colors characters in bash output?

北城以北 提交于 2019-12-01 06:34:26
tuxdna

You have multiple options:

EDIT

The solution from commandlinefu does the job pretty well:

sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"

The solution from unix.stackexchange might be better but is much longer and so you would want to create a separate script file because it is so long instead of just doing a shell one-liner.

I found this in the manual about the use of ANSI escape codes:

-no-ansi
    Do not use ANSI escape codes.

So you should add this option when starting the program.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!