NalleRooth.com

One of the reasons why I love Linux

The other day I was thinking about creating a Wordle solver. One thing you need in order to create such a tool is a list of five letter words. While I’m sure there are lots of sites where I can find such lists online, they may, or may not, include things like common names and abbreviations.

But you know what? I’ve already got that data on my hard drive. In my case, it’s located in the file /usr/share/dict/words (I’m using Manjaro Linux, your distro may use another location).

Looking at the top of that file, I can conclude several things.

head -n 20 /usr/share/dict/words
A
a
AA         <- Abbreviations are all caps
AAA
Aachen     <- Names are capitalized
Aachen's
aah
Aaliyah
Aaliyah's
aardvark
aardvark's
aardvarks
Aaron
Aaron's
AA's
AB
ab
ABA
aback
abacus

So, basically, we just need to grab all the five letter words in lowercase.

cat /usr/share/dict/words | grep -P '^[a-z]{5}$' > my_wordlist

And here’s the result, well.. the first 20 lines of it, at least.

aback
abaft
abase
abash
abate
abbes
abbey
abbot
abeam
abets
abhor
abide
abler
abode
abort
about
above
abuse
abuts
abuzz

With this data set done, it’s quite easy to move on to actually build the Wordle solver. But that’s a post for some other time.

What are your favourite gems in Linux?

Posted:
Tags: developers linux
comments powered by Disqus