How can I mark two columns in the middle of text.
grep --color '^[[:alnum:]]*[[:blank:]]' file
This mark text in the beginning, but I want to mark second and third columns. How can pass first one?
Try this with GNU grep:
grep --color -P '^[[:alnum:]]+[[:blank:]]+\K[[:alnum:]]+[[:blank:]]+[[:alnum:]]+' file
\K to see the difference. If \K appears in a Perl Regex (enabled by grep's option -P), it causes the regex matcher to drop everything before that point from the internal record.
– Cyrus
Aug 23 '15 at 09:45
gawkto add terminal escape sequences to$2and$3– cxw Aug 23 '15 at 09:13