A little while ago I was wondering just how many words I’ve written on my blog. I was inspired by Wouter over at Brain Baking . Now, I use a static site generator for my blog, the upshot of which is that the whole thing is just a big folder full of files. So counting up all the words is really easy with a simple shell command: wc --total=only -w content/blog/*/*.md 55198 That’s 55,198 total words as of the time of this writing. Well that’s neat. With a little bit of awk you can get the average too: wc --total=never -w content/blog/*/*.md \ | awk '{total+=$1} END{print total, total/NR}' 55270 321.337 (The change in total word count is because I am running these commands as I write this post.) And finally I have a breakdown of the number of posts by year. rg "^date: \d{4}-\d{2}-\d{2}" -t markdown -o content/blog \ | cut -d' ' -f2 \ | date -f - +"%Y" \ | sort | uniq -c \ | awk 'BEGIN{print "|Year|Number of posts|\n|----|----|"; OFS="|"} {printf "|%-4s|%-4s|\n", $2, $1}' That one is a…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.