Last updatedUpdated:by Simon Späti · CreatedCreated: · 2 min readrecently updatedRecent changes2 years ago+72 / −0 words3 years ago+13 / −13 words3 years ago+8 / −8 words3 years agopublished · 338 words
To document the progress of my book writing, I created a little script that outputs words written over time.
Markdown files in my Obsidian Vault:
1
find ~/Simon/Sync/SecondBrain -type f -name "*.md"| wc -l
#!/bin/bash
last_count=0# Iterate over each commitgit log --reverse --pretty=format:"%H %ad" --date=short |whilereadhash date;do# Check out the commit git checkout $hash&> /dev/null
# Count the words in markdown fileswords=$(find src -type f -not -path '*/\.*' -name '*.md' -exec cat {} + | wc -w)# Compare with the last count and output only if differentif["$words" -ne "$last_count"];thenecho"$date,$words"last_count=$wordsfidone# Check out the original branchgit checkout main