Skip to content

Instantly share code, notes, and snippets.

@mtfoley
Last active February 14, 2022 00:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtfoley/881671712965ef6d6349ae16890f9432 to your computer and use it in GitHub Desktop.
Save mtfoley/881671712965ef6d6349ae16890f9432 to your computer and use it in GitHub Desktop.
# List latest dev.to articles (curl), Extract non-blank tags and join by comma (jq)
# Replace commas with newlines (sed), Sort in alphabetical order and count unique words in format (sort | uniq -c)
# Sort again in reverse order to put highest counts at the beginning (sort -r), Switch print order to be "tag n" (awk)
curl -s "https://dev.to/api/articles?page=1&per_page=1000&state=fresh" \
| jq --raw-output 'map(.tags | select(.!="")) | join(", ")' \
| sed 's/, /\n/g' \
| sort | uniq -c \
| sort -r \
| awk '{ print $2, $1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment