parsing a curl in the command line – Education Career Blog

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)

Leave a Comment