Last active
December 14, 2015 07:38
-
-
Save breun/5051569 to your computer and use it in GitHub Desktop.
Search a list of words for all words with a certain length (here: 4) that can be formed from a list of characters (here: ['e','l','n','o','p','q']).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groovy -ne 'if (line.size() == 4 && line.toLowerCase().toList().sort().join() =~ /^e?l?n?o?p?q?$/) println line' /usr/share/dict/words |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Groovy port of https://gist.github.com/lukasvermeer/5070529