title: Need help coloring/replacing arbitrary strings using Bash and sed
body: <p>I'm using a bash script based on the technique used here: <a href="https://stackoverflow.com/questions/2437976/get-color-output-in-bash">Get color output in bash</a> 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:</p>
  
  <pre><code>** 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.
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>WelcomeMessage="WARNING"
  pathpat=".*"
  ccred=$(echo -e "\033[0;31m")
  ccyellow=$(echo -e "\033[0;33m")
  ccend=$(echo -e "\033[0m")
  git pull 2&gt;&amp;1 | sed -r -e "/$WelcomeMessage/ s%$pathpat%$ccyellow&amp;$ccend%g"
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>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&gt;&amp;1 | sed -r -e "/$WelcomeMessage/ s%$pathpat%$ccyellow&amp;$ccend%g"
  </code></pre>
  
  <p>This fails with the error: sed: -e expression #1, char 78: unterminated address regex</p>
  
  <p>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.</p>
  
  <p>Any help is appreciated.  Thanks!</p>