riv*_*ivu 13 linux html terminal curl conversion
如何在 Linux 中将 HTML 转换为文本文件?例如,我想向curlGoogle 查询,然后将输出的 html 转换为文本并在我的终端上读取转换后的文本。我正在使用 RHEL6。
小智 11
我认为 curl 没有内置的 HTML 处理器。然而:
lynx --dump <URL>
Run Code Online (Sandbox Code Playgroud)
诀窍。
如果你仍然想使用 curl,你可以使用html2text(在 Ubuntu 中可用)。
您可以安装html2text(高级 HTML 到文本转换器)并且用法很简单:
$ html2text http://example.com/
$ cat file.html | html2text -o file.txt
Run Code Online (Sandbox Code Playgroud)
安装方式:
apt-get install html2textbrew install html2text示例curl:
$ curl -sL google.com | html2text
Search Images Maps Play YouTube News Gmail Drive More ?
Web History | Settings | Sign in
A better way to browse the web
Get Google Chrome
Advanced search Language tools
[Google Search][I'm Feeling Lucky]
Advertising Programmes Business Solutions+GoogleAbout GoogleGoogle.com
? 2016 - Privacy - Terms
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17774 次 |
| 最近记录: |