Skip to content

Instantly share code, notes, and snippets.

@mark-rushakoff
Created April 5, 2013 14:58
Show Gist options
  • Save mark-rushakoff/5319950 to your computer and use it in GitHub Desktop.
Save mark-rushakoff/5319950 to your computer and use it in GitHub Desktop.
Count words in your Leanpub book
#!/bin/sh
BOOK_SRC="${$1:-Book.txt}"
cat "$BOOK_SRC" | xargs cat | # dump out all the files in the book
sed 's/%%.*$//g' | # naively strip comment delimiter to end of line
wc -w | # print out the word count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment