[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30686: How to color matched region but also show the nearby context
From: |
Peng Yu |
Subject: |
bug#30686: How to color matched region but also show the nearby context noncolored in characters or words? |
Date: |
Fri, 2 Mar 2018 22:04:01 -0600 |
Hi,
I am looking for a feature similar to -A -B -C but not based on lines,
but based on characters or even words. Is it possible with the current
version of grep?
In the following example, I'd like to show the matched region as well
as 3 characters before and after it. But the 3 characters before and
after the match is also showed.
grep --color -o -P '.{0,3}a.{0,3}' <<< '+++++++++++++++++a++++++++++++++++++++'
--
Regards,
Peng
- bug#30686: How to color matched region but also show the nearby context noncolored in characters or words?,
Peng Yu <=