0
我有一個HTML創建腳本,並在其中我試圖:查找HTML字符串和備註
1)更換RelatedLinksBlock的所有實例使用SED
2.多行DOS變量)查找一個是匹配的DOS變量和REM出來或使用SED
我不能讓任何SED命令幾個小時後,開始工作,需要一些幫助刪除字符串。
CODE:
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set nl=^& echo.
set fullHTMLpath=http://this.com
set FileTitle=Computer TEST
set keyfile=test.html
set rempath=REMthisOUT
set "delpath=^<li^> - ^<a href="%fullHTMLpath%" title="%FileTitle%"^>%FileTitle%^</a^>^</li^>"
set "path1=^<li^> - ^<a href="http://that.com/computers-and-operating-systems/asus-computer-support.html" title="ASUS Computer Support"^>ASUS Computer Support^</a^>^</li^>"
set "path2=^<li^> - ^<a href="http://that.com/computers-and-operating-systems/asus-laptop-support.html" title="ASUS Laptop Support"^>ASUS Laptop Support^</a^>^</li^>"
set "path3=^<li^> - ^<a href="http://that.com/computers-and-operating-systems/asus-support.html" title="ASUS Support"^>ASUS Support^</a^>^</li^>"
set alllinks=%path1%%nl%%path2%%nl%%path3%
sed -i "s/RelatedLinksBlock/%alllinks%/g" "%keyfile%"
sed -i "s/%delpath%/%rempath%/g" "%keyfile%"
謝謝