How to run spell check on multiple files and display any incorrect words in shell script?

You can install aspell with Homebrew on OS X. brew info aspell lists supported languages.

brew install aspell --lang=en,fi,jp

aspell check opens a file in an interactive spell checker:

for f in *.txt; do aspell check $f; done

aspell list prints all unrecognized words:

cat *.txt | aspell list | sort -u

Learned words are stored in .aspell.en.pws by default. You can also exclude words in ~/Library/Spelling/en after adding personal_ws-1.1 en as the first line.

aspell list --personal=$HOME/Library/Spelling/en

Leave a Comment