Skip to content

Instantly share code, notes, and snippets.

@manfromth3m0oN
Created May 2, 2023 14:41
Show Gist options
  • Save manfromth3m0oN/fe8d6892c8266a9cf3a170fc879d37e3 to your computer and use it in GitHub Desktop.
Save manfromth3m0oN/fe8d6892c8266a9cf3a170fc879d37e3 to your computer and use it in GitHub Desktop.
Markdown Wordcount Script
#!/bin/bash
if [ $(uname -s) == "Linux" ]
then
sed=sed
elif [ $(uname -s) == "Darwin" ]
then
sed=gsed
fi
$sed '/^```/,/^```/d' | $sed 's/#\+ //g;s/\\\w\+\({\w\+}\)\?//g;s/\[\w\]//g;s/{[[:digit:]]\.[[:digit:]]\(cm\)\?}//g;s/!\[\w\+\](\w\+)//g;s/!\[[A-Z a-z]\+\].\+//g;/^[[:space:]]*$/d;/`*\+`/d' | tr -d "{}|-()[]!:>"
cat *.md | ./coverage.sh | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment