关于解析HTML并使用shell提取数据 [英] About parsing html and extract data using shell

查看:740
本文介绍了关于解析HTML并使用shell提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解析一个html并使用shell脚本提取4个部分的html。但是,我对shell非常陌生。我只是从for循环开始,通过 cat $ 1 来查看html的每一行。任何人都可以帮我或给我建议吗?

HTML-XML-utils



您可以使用 htmlutils

  $ curl -s http://example.com/ | hxselect title 
< title>示例域< / title>

有关更多示例,请查看

I need to parse a html and extract 4 parts of the html using shell script. However, I am quite new to shell. I just start by a for loop to cat $1 to look through each line of the html. Can anybody help me or give me advice?

解决方案

HTML-XML-utils

You may use htmlutils for parsing well-formatted HTML/XML files. The package includes a lot of binary tools to extract or modify the data. For example:

$ curl -s http://example.com/ | hxselect title
<title>Example Domain</title>

For more examples, check the .

这篇关于关于解析HTML并使用shell提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆