Solving Wordle with Grep3 min read

I recently started playing Wordle and realized, I’m not very good at it. But what I am good at is technology, and more specifically Linux, so I wanted to see if there was a way to increase my win count using Linux tools.

Enter GREP:

Grep is a wonderful tool used for advanced searching and pattern matching. So let’s use Grep to solve Wordle;

The first step with Wordle is always to make a good first guess. I generally start with the word House as my starting.

This gave me a good start, I had one known place and two known letters. So let’s start Grepping.

grep -E "^([a-gi-z]{1}[a-z]{2}[a-rt-z]{1}e)$" /usr/share/dict/american-english | grep -Ev "([ou])" | less

This command in short searches through the linux American English Dictionary looking for words that exactly 5 letters long, have an E at the end, and don’t have an H at the start or an S at the second to last letter. Then is does a second grep this time removing any words with the letters OU.

This gives us a lot of possibilities, so we still need to take some standard Wordle practice and pick a word that meets the clues we know and does not have duplicates. We can add another grep to only pull words that have H or S by adding the following to the end.

grep -E "([hs]{1,5})" 

Now we’ve narrowed down the word list

Let’s pick a word that meets our requirements. Scrolling down the list we find the first word with both an S and an H in it that also ends in E: Shade.

Look at that. We’re close. Really close. Now just time to update the grep command again.

grep -E "^(sha[a-z]{1}e)$" /usr/share/dict/american-english | grep -Ev "([oud])" | less

We not have a list of 6 possible words. Unfortunately there’s no way to predict which of these 6 words it is so we just have to guess and hope we pick the right one in the next 4 guesses.

Starting at the top of the list gives us our answer this time.

I’ve been using this strategy for the last week and it’s been very successful for me. I currently have a 100% win rate. The key to this is to keep eliminating words and then improving on the filters based on the clues we get.

WordPress Appliance - Powered by TurnKey Linux