使用 sed 将 URL 转换为 HTML 链接? [英] Convert URLs into HTML links using sed?
本文介绍了使用 sed 将 URL 转换为 HTML 链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有可能(推荐可能是更好的词)使用 sed 将 URL 转换为文档中的 HTML 超链接.因此,它会寻找以下内容:
I'm wondering if it's possible (recommended might be the better word) to use sed to convert URLs into HTML hyperlinks in a document. Therefore, it would look for things like:
http://something.com
并用
<a href="http://something.com">http://something.com</a>
有什么想法吗?电子邮件地址也可以这样做吗?
Any thoughts? Could the same also be done for email addresses?
推荐答案
这可能有用.
sed -i -e "s|http[:]//[^ ]*|<a href=" ">