j18txw
Last Updated: February 25, 2016
·
345
· alexvpopov
058744c91d324bf29bb5423b5ce7bdde

Remove color codes from a file to view it in a text editor

If you pipe a console command, which colorizes console output, such as rspec or some rake tasks, to a file and you open it in a text editor, you will see a lot of color codes, such as ESC[35m mingled with rest of the file content. These can make reading the file quite hard. Fortunately, you can easily remove this codes with a simple Find and Replace operation in Sublime Text 2. Just follow these steps:

  1. Open the file in Sublime Text.
  2. Find -> Replace
  3. Enable searching by regular expression (Shortcut Alt+R on Ubuntu)
  4. Find What: \e\[\d+m
  5. Replace With - just leave empty.
  6. Click Replace All.
Say Thanks
Respond