[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

【已解决】[30元红包]求批量替换html指定标签中的内容

本帖最后由 baibat 于 2022-7-9 12:10 编辑

具体报酬:30元人民币。
支付方式:支付宝
联系方式:QQ865768557
有效期限:2022年7月24日之前。

需求:
有一批html文件,需要给<body>内<p>标签文本添加<span>以便调整字体样式,已经将<p>标签内的文本复制到txt文件中,手动分句分行排列,并在句子前后添加<span id=light>...</span>,txt文件与对应的html文件同名,并保存为utf-8格式。
想要实现的功能是,将原每对<p></p>标签之间的内容使用添加了<span id=...>标签的句子进行替换,比如其中一个html文件内容:

原html内容:
<div class="Step_Bullet">
<p class="nonindent">Veronica struggled to her feet, mentally swearing at the sagging couch—there was no way to stand gracefully. <a id="page14"/>She ended up doing an undignified little hop to catch her balance<a href="http://www.novel.net">.</p>
<p class="indent"><em>“Mr. Mars is actually on a leave of absence right now. I’m covering his caseload.”</em><a id="page14"/>She held out her hand, and the woman hesitated for a moment before shaking it. “I’m Veronica Mars.”</p>
</div>

替换后:
<p class="nonindent"><span>Veronica struggled to her feet, mentally swearing at the sagging couch—there was no way to stand gracefully.</span>
<span><a id="page14"/>She ended up doing an undignified little hop to catch her balance<a href="http://www.novel.net">.</span></p>
<p class="indent"><span><em>“Mr. Mars is actually on a leave of absence right now. I’m covering his caseload.”</em><a id="page14"/></span>
<span>She held out her hand, and the woman hesitated for a moment before shaking it.</span>
<span>“I’m Veronica Mars.”</span></p>

希望能实现批量替换,并且不影响原html文件的显示排版。

如果有答主觉得使用sed工具更容易实现也行,只要能教会我这种小白怎么用就行。


---------------------------------------------------
补充测试的文件:http://pan.gzaune.com/f.php?h=3lQQZw40&d=1

此帖仅作者可见
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

此帖仅作者可见
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

返回列表