この問題は私を少しの間壁に押し上げてきました、私はトンを検索しました、そして他の誰も私のために働く解決策がないようです...
sed "s|{{/each}}| -->\n $photostr |" $1
だから私はコメントを終わらせようとしていて、私の写真の文字列を叩きます。$photostrとは
<a data-gallery="gallery" href="The_Great_Wave.jpg" title=" The Great Wave off Kanagawa"> <img src="bar" alt=" The Great Wave off Kanagawa"/></a>
<a data-gallery="gallery" href="Mt_Fuji.jpg" title=" Mount Fuji (the highest mountain in Japan)"> <img src="bar" alt=" Mount Fuji (the highest mountain in Japan)"/></a>
<a data-gallery="gallery" href="Beach.jpg" title=" Waves Crashing on the Beach"> <img src="bar" alt=" Waves Crashing on the Beach"/></a>
<a data-gallery="gallery" href="Elephant.jpg" title=" An Elephant in the Serengeti"> <img src="bar" alt=" An Elephant in the Serengeti"/></a>
<a data-gallery="gallery" href="Milky_Way.jpg" title=" The Milky Way Galaxy (contains our Solar System)"> <img src="bar" alt=" The Milky Way Galaxy (contains our Solar System)"/></a>
<a data-gallery="gallery" href="Poppies.jpg" title=" Poppies in Bloom"> <img src="bar" alt=" Poppies in Bloom"/></a>
メタ文字がぎっしり詰まっているので、デリメータとしてパイプを使用していますが、このエラーが発生します...
sed: -e expression #1, char 70: unterminated `s' command
入力の場合、$ 1は、htmlといくつかの{{metatag}}を含むファイルであり、機能するWebページを作成するために適切な置換が必要です。私が心配していることは、
</a>
{{/each}}
</div>
に変換する必要があります...
</a>
-->
<a data-gallery="gallery" href="The_Great_Wave.jpg" title=" The Great Wave off Kanagawa"> <img src="bar" alt=" The Great Wave off Kanagawa"/></a>
<a data-gallery="gallery" href="Mt_Fuji.jpg" title=" Mount Fuji (the highest mountain in Japan)"> <img src="bar" alt=" Mount Fuji (the highest mountain in Japan)"/></a>
<a data-gallery="gallery" href="Beach.jpg" title=" Waves Crashing on the Beach"> <img src="bar" alt=" Waves Crashing on the Beach"/></a>
<a data-gallery="gallery" href="Elephant.jpg" title=" An Elephant in the Serengeti"> <img src="bar" alt=" An Elephant in the Serengeti"/></a>
<a data-gallery="gallery" href="Milky_Way.jpg" title=" The Milky Way Galaxy (contains our Solar System)"> <img src="bar" alt=" The Milky Way Galaxy (contains our Solar System)"/></a>
<a data-gallery="gallery" href="Poppies.jpg" title=" Poppies in Bloom"> <img src="bar" alt=" Poppies in Bloom"/></a>