Closed Captioning Closed captioning available on our YouTube channel

How to use the grep command to cheat in Wordle: 2-Minute Linux Tips

Network World | May 20, 2022

In this Linux tip, learn how you can use the grep command to cheat when you play Wordle. Linux systems can be very helpful in this because of the many commands it provides and the fact that it includes a lengthy words file.

Copyright © 2022 IDG Communications, Inc.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to check out how you can cheat when you play wordle. Linux systems can be very helpful in this because of the many commands it provides and the fact that it includes a lengthy words file. On my system, this is /usr/share/dict/words and it's nearly half a million words long. But, since wordle only uses 5-letter words, the first step should be to copy those lines into a separate file with something over 20,000 words:
Now, let's say you guessed "agent" on wordle and you now know that the middle letter of the word is an "e" and the last letter is a "t". You also know that the word contains the letter "a", but not in the position you put it in. You can use grep to see how many words match this pattern, but 155 words is a lot to look through!
To narrow down the possible matches, you run a command like this one that matches on the letters you know and requires the letter that was in the wrong position, but omits any words that include that "a" as the first letter. This cuts the possible matches from 155 to 16.
So, in spite of the more than 20,000 words in the 5letters file, you've reduced the possible words to 16. You can try guessing which of these words is the right one and, if it isn't right, do some more cheating. If you try "wheat" next, wordle might come back and tell you that all but the first letter is correct, leaving you with only 4 matches.
That’s your Linux tip for using grep to cheat on wordle. If you had any doubts, the correct word was "cheat".
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.
Popular
Featured videos from IDG.tv