开发者

parsing a curl in the command line

开发者 https://www.devze.com 2023-01-21 05:21 出处:网络
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 <

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

精彩评论

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