Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape ANSI-codes #51

Closed
vk26 opened this issue Mar 25, 2020 · 2 comments
Closed

Escape ANSI-codes #51

vk26 opened this issue Mar 25, 2020 · 2 comments

Comments

@vk26
Copy link
Contributor

vk26 commented Mar 25, 2020

Hi. Many CLI tools output highlighted, colorized text. Special ANSI-codes are used in this cases. For example ruby linter fasterer output:

fasterer | cat -A
^[[0;31;49mtestdata/examples.rb:3^[[0m Array#shuffle.first is slower than Array#sample.$

where ^[[0;31;49m ... ^[[0m - red-color ANSI-codes.
I tried to handle this ANSI-codes via efm masks, but i didn't cope with it. May be is there solution for escaping ANSI-codes?

@mgrachev
Copy link
Member

mgrachev commented Mar 27, 2020

@vk26 👋You can use something in the middle to remove ANSi-codes. For example:

fasterer | sed 's/\x1b\[[0-9;]*m//g' | cat -A

@vk26
Copy link
Contributor Author

vk26 commented Mar 30, 2020

@mgrachev Good idea! Thanks 👍

@vk26 vk26 closed this as completed Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants