Hacker News new | ask | show | jobs
by unhammer 4034 days ago
Don't use awk for parsing XML/JSON, there are excellent tools like html-xml-utils or jq that already do that well:

    $ sudo apt-get install html-xml-utils jq

    $ curl 'https://duckduckgo.com/html/?q=cake' | hxclean \
       | hxselect  .web-result:first-child .snippet

    $ curl apy.projectjj.com/listPairs | jq .responseData[0]

Though I'd typically use Python's BeautifulSoup for anything major with html, there's just too much bad html out there ;)
1 comments

wow, didn't even know of jq but look's super cool. was trying to avoid using packages you would have to 'install' since it seemed that all the functionality the post I responded to used built-in's for powershell commands.