如何提取页面标题 [英] How to extract a page title
本文介绍了如何提取页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从HTML页面中提取页面标题
I am trying to extract the page title from an HTML page
cat index.html | grep -i "title>"| sed 's/<title>/ /i'| sed 's/<\/title>/ /i'
写在一行! (相信我吧)
The problem happens when some pages are written in one line! (believe me it happens)
我如何解决这个问题?
谢谢!
推荐答案
sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q'
href =http://www.pixelbeat.org/cmdline.html =nofollow noreferrer> Linux命令。
From Linux Commands.
Google的第一个结果: unix提取页面标题
。
1st result for Google: unix extract page title
.
这篇关于如何提取页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文