Mac: Solving Hangman using Command Line Regular Expressions

In this video I use basic regular expressions (via grep) to search for words in the Mac dictionary file.

This is the hangman game I used in the video: https://hangmanwordgame.com/

Count Words in the Dictionary File
wc -l /usr/share/dict/words
Search for Incomplete Word (_AL_ATION) in the Dictionary
grep -i '^.al.ation$' /usr/share/dict/words
Exclude Letter (e) from Search
grep -i '^.al.ation$' /usr/share/dict/words|grep -vi 'e'
Count the Number of Matches in a Search
grep -i '^.al.ation$' /usr/share/dict/words|grep -vi 'e' | wc -l

Leave a comment

Your email address will not be published. Required fields are marked *