2

Recently I came across grc and I find it really simple. However, I would like to highlight some chunks of regex-matched text. For example, svn status properties conflict highlight I hoped to work:

regexp=^.(C)
colours=black on_yellow

Unfortunately the first character gets yellow too, because grc doesn't seem to apply highlight to the capture group only. Is there any way to highlight the second character only? Or is there a better way to workaround (any other tool can be an option too, sure)?

1

You might want to check your regex with a tester like regex101.

You might want to try colout, which is like an alternative to grep --color.

colout REGEX [COLOR] [STYLE]

Use colout -r all to list all resources.

AFAIK you can make your own theme and name it colout_*.py where * is the file extension.

I would use grc to permanently alias a command (although redirection doesn't seem to work well, e.g. try ping to an unknown host to see what I mean), colout for occasionally parsing files.

Other colourisers you might want to try
· list of colourisers
· highlight (which I use in OS X with QLColorCode)
· pygments (haven't tried this one yet)

EDIT
Use undocumented keyword unchanged. This works

regexp=^.(C)
colours=unchanged,black on_yellow
  • colout seems to be a good option, however I'm not sure if styles can cascade like grc styles. I'll check it as soon as possible. – Lyubomyr Shaydariv Oct 28 '15 at 21:04
  • It would be great. Could you please update your answer? (Sorry have no access to a desktop right now) – Lyubomyr Shaydariv Oct 28 '15 at 23:29
  • colout still seems to be the closest match to the question (especially it features some cool stuff), but I couldn't find any config files feature. – Lyubomyr Shaydariv Oct 29 '15 at 13:32
  • As far as I see, colout -t is the best choice, but it seems to use preinstalled themes. Not sure if I'm right. – Lyubomyr Shaydariv Oct 30 '15 at 15:39
  • Hi, sorry for late reply. No, I couldn't figure out how to configure colout so it could work as I want it to work at that time, and I simply threw it away. – Lyubomyr Shaydariv Nov 20 '15 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.