【发布时间】:2017-09-12 08:43:30
【问题描述】:
我在 SO 上看到了与此类似的其他问题,但没有一个能解决我的问题。
我有一个本地 html 页面,我想提取链接,但我不只想要链接我想要创建链接的整个标签,比如
<a href="page1.html">My Page 1</a>
<a href="page2.html">My Page 2</a>
<a href="page3.html">My Page 3</a>
如果它更容易,我可以接受
My Page 1
page1.html
My Page 2
page2.html
My Page 3
page3.html
我已经尝试过这个命令,它是关于 SO 上另一个问题的答案
grep "<a href=" t2.html |
sed "s/<a href/\\n<a href/g" |
sed 's/\"/\"><\/a>\n/2' |
grep href
但由于某种原因,它只是从页面中提取了几个链接
如果你想看,this is the page我正在尝试提取链接。
谢谢
【问题讨论】: