我正在尝试替换macOS Terminal中包含换行符的变量的内容,但是出现此错误或其他错误:
echo $index | sed "s/{{content_2}}/$side/g"
输出:
sed: 1: "s/{{content_2}}/<div cl ...": unescaped newline inside
替代模式
这是$ index:
{{navbar}} {{content_10}} {{content_2}} {{footer}}
这是$ side:
<div class="col-md-2"><div class="content" id="contentAside"><h5 class="text-uppercase pt-3">Aside</h5><div class="card" style="width: 18rem;"><img class="card-img-top" src="img/card.jpg" alt="Card image cap"><div class="card-body"><h5 class="card-title">Card title</h5><p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p><hr><p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p><hr><p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p><hr><p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p><hr><a href="#" class="btn btn-primary">Go somewhere</a></div></div></div></div>