Wordle cheat script

An article on The Register linked to a GitHub shell script version of Wordle, and what caught my eye was that apparently a Linux installation contains a dictionary of English words in the file /usr/share/dict/words.

If you are stuck in your daily Wordle, you can use this file to figure out solutions:

CommandPurpose
grep -E '^([a-zA-Z]){5}$' /usr/share/dict/wordscollect all 5-letter words
tr '[a-z]' '[A-Z]'convert words to upper case
grep 'RU...'filter words for matching (green) letters
grep '[E]'filter words for letters in the wrong spot (yellow)
grep -v '[ASD]'exclude known wrong letters (dark grey)

Combine the commands (the last 3 are optional) with the respective letters filled in, separated by the pipe “|”:

$ grep -E '^([a-zA-Z]){5}$' /usr/share/dict/words | tr '[a-z]' '[A-Z]' | grep 'RU.E.' | grep -v '[TASDLMN]'
RUPEE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.