Skip to content

Instantly share code, notes, and snippets.

@tnzk
Last active April 7, 2021 07:16
Show Gist options
  • Save tnzk/11a57e5422bd53878d18fe27f29313ae to your computer and use it in GitHub Desktop.
Save tnzk/11a57e5422bd53878d18fe27f29313ae to your computer and use it in GitHub Desktop.
Download all of top-level comments in a story and generates histgram of words
# cf. https://github.com/HackerNews/API
ITEM_ID=8863
curl https://hacker-news.firebaseio.com/v0/item/$ITEM_ID.json | jq -r .kids[] | xargs -I {} echo "curl -o {}.txt https://hacker-news.firebaseio.com/v0/item/{}.json"
cat *txt | tr '[:punct:]' ' ' | tr 'A-Z' 'a-z' | tr -s ' ' | tr ' ' '\n' | sort | uniq -c | sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment