title: Replacing Variables Containing Newlines in macOS Terminal
body: <p>I'm trying to replace the content of a variable consisting newlines in macOS Terminal but this error or some other errors show up:</p>
  
  <pre><code>echo $index | sed "s/{{content_2}}/$side/g"
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>sed: 1: "s/{{content_2}}/&lt;div cl ...": unescaped newline inside
  </code></pre>
  
  <p>substitute pattern</p>
  
  <p>This is $index: </p>
  
  <pre><code>{{navbar}} {{content_10}} {{content_2}} {{footer}}
  </code></pre>
  
  <p>This is $side:</p>
  
  <pre><code> &lt;div class="col-md-2"&gt;&lt;div class="content" id="contentAside"&gt;&lt;h5 class="text-uppercase pt-3"&gt;Aside&lt;/h5&gt;&lt;div class="card" style="width: 18rem;"&gt;&lt;img class="card-img-top" src="img/card.jpg" alt="Card image cap"&gt;&lt;div class="card-body"&gt;&lt;h5 class="card-title"&gt;Card title&lt;/h5&gt;&lt;p class="card-text"&gt;Some quick example text to build on the card title and make up the bulk of the card's content.&lt;/p&gt;&lt;hr&gt;&lt;p class="card-text"&gt;Some quick example text to build on the card title and make up the bulk of the card's content.&lt;/p&gt;&lt;hr&gt;&lt;p class="card-text"&gt;Some quick example text to build on the card title and make up the bulk of the card's content.&lt;/p&gt;&lt;hr&gt;&lt;p class="card-text"&gt;Some quick example text to build on the card title and make up the bulk of the card's content.&lt;/p&gt;&lt;hr&gt;&lt;a href="#" class="btn btn-primary"&gt;Go somewhere&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>