hi,
I'd like to have colored the first occurrence of an email address xxxx@xxxx.xxx.xxx in each matched line
I tried with gnu grep like this:
grep --color -P "[[:space:]]+[[:alpha:]]+@[[:alnum:]]+.+[[:space:]]" input
but it shows all in color to the end of line.
I found another way with tput:
# on=$(tput setaf 7; tput setab 1; tput bold) off=$(tput sgr0)
# sed "s/[^[:blank:]]\{1,\}/$on&$off/10" input
it is coloring column 10, but can the sed be learned to color first column matching the 'e-mail' pattern?
I'd like to have colored the first occurrence of an email address xxxx@xxxx.xxx.xxx in each matched line
I tried with gnu grep like this:
grep --color -P "[[:space:]]+[[:alpha:]]+@[[:alnum:]]+.+[[:space:]]" input
but it shows all in color to the end of line.
I found another way with tput:
# on=$(tput setaf 7; tput setab 1; tput bold) off=$(tput sgr0)
# sed "s/[^[:blank:]]\{1,\}/$on&$off/10" input
it is coloring column 10, but can the sed be learned to color first column matching the 'e-mail' pattern?