I’m using grep from the command line via cygwin. I’m wondering if there’s any way to get it to highlight the part of each line that matches the regex. The closest thing I’m seeing is the -o option, but that only outputs the matching area, and I’d like to see the entire line.
Share
Take a look at the –color (or –colour) option, e.g.
By default, this uses the “auto” mode which only includes the color codes when output to a terminal, but not when you pipe the output elsewhere. If you want the colors piped out to something other than stdout, then use –color=always
See the linked article for ways you can change the colour and make grep use this option by default.