Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Nice. I wonder if one could go further and do something like grep -E $'\033\[0?[01];31m.+?\033\[0?0m' or grep -Po '\033\[0?[01]+;31m\K.+?(?=\033\[0?0m)' to test for red specifically? Commented Jun 6, 2014 at 1:04
  • I started coming up with regexes like the ones you suggest, but before I could get them to work I stumbled upon [[:cntrl:]]. I tested yours and they work for me, ie. matching red and failing to match other colors. Commented Jun 6, 2014 at 1:10
  • Works great but will match any color. I didn't mention it in the question but many other colors are also output and I just want to see the red stuff. +1 for simple and working code. Commented Jun 6, 2014 at 2:38