首页 > 解决方案 > 将 html 行拆分为多行

问题描述

我需要一些帮助。我有一些文件就像

<table><tr><td>This is a  test</td></tr><td><div align="center"><img src=""><a href="">test</a></td></table>

我正试图将它们分开

<table>
<tr>
<td>This is a  test</td>
</tr>
<td>
<div align="center">
<img src="">
<a href="">test</a>
</td>
</table>

你能帮我吗?

谢谢

标签: htmlsplit

解决方案


我能够使用 sed 来做到这一点,更具体的是这样

sed -i 's/></>\n</g' file1

推荐阅读