开发者

parsing a curl in the command line

I have this:

curl -H \"api_key:{key}\" http://api.wordnik.com/api/word.xml/dog/definitions

How do I parse this (within the commandline) 开发者_运维问答to make it take whatever's in between <text> and </text> in this page?


$ curl ....... | awk -vRS="</text>" '/<text>/{ gsub(/.*<text/,""); print "->"$0}'

$ curl ....... | awk 'BEGIN{RS="</text>"}/<text>/{ gsub(/.*<text/,""); print "->"$0}'

Note, use GNU awk. (gawk)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜