Q:

Need help coloring/replacing arbitrary strings using Bash and sed

I'm using a bash script based on the technique used here: Get color output in bash to color the output of my builds and other scripts to make things easier to read.  One of the steps in my build executes a "git pull" and the git server spits out a "welcome" string like this amidst a bunch of other output:
** WARNING: THIS IS A PRIVATE NETWORK.  UNAUTHORIZED ACCESS IS PROHIBITED. **
   Use of this system constitutes your consent to interception, monitoring,
   and recording for official purposes of information related to such use,
   including criminal investigations.

I'd like to color this specific message yellow or possibly delete it from the output while leaving the rest of the output alone. I've tried to replace a simple string like this:
WelcomeMessage="WARNING"
pathpat=".*"
ccred=$(echo -e "\033[0;31m")
ccyellow=$(echo -e "\033[0;33m")
ccend=$(echo -e "\033[0m")
git pull 2>&1 | sed -r -e "/$WelcomeMessage/ s%$pathpat%$ccyellow&$ccend%g"

The first line of the welcome string is colored yellow as expected but the rest of the lines are not.  I'd really like to color the exact welcome string and only that string but for many reasons, this doesn't work:
WelcomeMessage="** WARNING: THIS IS A PRIVATE NETWORK.  UNAUTHORIZED ACCESS IS PROHIBITED. **
   Use of this system constitutes your consent to interception, monitoring,
   and recording for official purposes of information related to such use,
   including criminal investigations."
pathpat=".*"
ccred=$(echo -e "\033[0;31m")
ccyellow=$(echo -e "\033[0;33m")
ccend=$(echo -e "\033[0m")
git pull 2>&1 | sed -r -e "/$WelcomeMessage/ s%$pathpat%$ccyellow&$ccend%g"

This fails with the error: sed: -e expression #1, char 78: unterminated address regex
I've looked at a couple other questions and I was able to get the asterisks escaped (by preceding them with backslashes) but I'm baffled by the periods and multiple lines.  I'd like to continue using sed to solve this problem since it integrates nicely with the colorizing solution.
Any help is appreciated.  Thanks!

A:

The following will colorize in yellow every line from the first instance of ** to the first instance of a period . that's not on the same line. This will match the entire warning message as written.
NORMAL=$(tput sgr0)
YELLOW=$(tput setaf 3)

git pull 2>&1 | sed "/\*\*/,/\./s/.*/$YELLOW&$NORMAL/"

Note: If you want to delete the message you can use this:
git pull 2>&1 | sed '/\*\*/,/\./d'

