![](/img/trans.png)
[英]Setting TOMCAT_HOME on Terminal. No such file or directory found
[英]Find and replace in text file with terminal. How to escape all the characters?
我正在嘗試使用終端替換文件中的一些html代碼。
這是我正在使用的命令
perl -pi -w -e 's/find/replace/g;' /Volumes/Abc.html
我正在嘗試更換
<body>
同
<body>
<div style="text-align: center;page-break-after:always;padding-top:0%;">
<img src="images/image-001.jpg" id="illustration" alt="illustration" />
<div id="caption" style="text-align:right;font-style:italic;"></div>
</div>
所以我一直在嘗試這個,但我無法弄清楚如何逃避所有角色。 你能幫我嗎?
perl -pi -w -e 's/<body>/<body>
<div style="text-align: center;page-break-after:always;padding-top:0%;">
<img src="images/image-001.jpg" id="illustration" alt="illustration" />
<div id="caption" style="text-align:right;font-style:italic;"></div>
</div>
/g;' /Volumes/Abc.html
謝謝!
使用其他分隔符,例如{}
。
perl -pi -w -e 's{<body>}{...}g' /Volumes/Abc.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.