0
我有一張表,其中包含數百個帶有屏幕截圖的指南。截圖圖像被錨點標記包圍,因爲它們之前可以點擊,但現在我需要刪除錨點標記。所有要刪除的定位標記都有一個href=#screenshot
,後面跟着一個數字,如下例所示。我的計劃是使用mysqldump轉儲表,然後使用sed查找並替換正確的字符串。使用SED在數據庫中的html中刪除特定的錨標記
<p>Choose <a href="/components">components</a> to install and click next.</p>
<div class="screen">
<a href="#screenshot3"><img src="/images/screens/install/step3.jpg" alt="Step 3"></a>
</div>
應該
<p>Choose <a href="/components">components</a> to install and click next.</p>
<div class="screen">
<img src="/images/screens/install/step3.jpg" alt="Step 3">
</div>
我可以使用<a\shref\=\"#screenshot\d+\"\>
第一標籤匹配,但我也需要這樣既可以同時不刪除其他錨標記被刪除其第二關閉標籤相匹配。任何幫助將不勝感激!