title: multi-line sed expression doesnt work
body: <p>I'm trying to insert specific xml configuration inside a specific xml element in a configuration file with sed in a bash shell script. When using the sed command on one line it works but when the expression is on multiple lines, it doesnt.</p>
  
  <p>I'm trying to insert the xml configuration inside the  element which is almost in the middle of the file so i was using the line to test sed 's//\nconfig/gi' file.xml and that works, but i need to add a lot more configuration, so the resulting sed command is like this:</p>
  
  <pre><code>sed -i '
  /broker/broker\n \
      &lt;plugins&gt; \
          &lt;jaasAuthenticationPlugin configuration="activemq" /&gt; \
          &lt;authorizationPlugin&gt; \
              &lt;map&gt; \
                  &lt;authorizationMap&gt; \
                      &lt;authorizationEntries&gt; \
                          &lt;authorizationEntry topic=&gt; read="admins" write="admins" admin="admins" /&gt; \
                          &lt;authorizationEntry queue=&gt; read="admins" write="admins" admin="admins" /&gt; \
                      &lt;/authorizationEntries&gt; \
                  &lt;/authorizationMap&gt; \
              &lt;/map&gt; \
          &lt;/authorizationPlugin&gt;
      &lt;/plugins&gt;/' $ACTIVEMQ_CONFIG
  </code></pre>
  
  <p>I originally wrote this as a here document in bash, but it turns out that the sed command itself needs escaping/line continuation character anyway so it didnt help much with having a prettier code.</p>
  
  <p>The command above gives me the error message "unterminated address regex" and i cant really see the reason why since its basically sed 's/pattern/replace/' which is the syntax. If im adding the s/ to the start of the sed command i just get a message saying that the s was not terminated properly.</p>
  
  <p>I have been searching for quite some time to try to figure how to manage multiple line seds script and i though i was just going to write a sed script but then i need another script as well in addition to the shell script and im not sure i would want that just for a configuration change, it seems a little overkill.</p>