我尝试为以下数据编写一个 shell 脚本
输入文件page.txt的内容:
enter a first page title<br><div style="margin-left: 40px;">enter a first point <br></div><div style="margin-left: 80px;">enter a second point<br></div><div style="margin-left: 120px;">enter a third point<br></div><div style="margin-left: 80px;"><br></div><div style="margin-left: 40px;"><br></div><div style="margin-left: 40px;"><br></div>
算法 :
Read the pages file
Replace <br> with newline
Replace <div style="margin-left: 40px;"> with 1 tab
Replace <div style="margin-left: 80px;"> with 2 tab
Replace <div style="margin-left: 120px;"> with 3 tab
Replace <div style="margin-left: 160px;"> with 4 tab
我正在尝试使用它
tr '<br>' '\n' < page.txt
预期的输出文件
enter a first page title
enter a first point
enter a second point
enter a third point
请告诉告诉如何编写上面提到的脚本..