Skip to content

Instantly share code, notes, and snippets.

@breun
Last active December 14, 2015 07:38
Show Gist options
  • Save breun/5051569 to your computer and use it in GitHub Desktop.
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']).
groovy -ne 'if (line.size() == 4 && line.toLowerCase().toList().sort().join() =~ /^e?l?n?o?p?q?$/) println line' /usr/share/dict/words
@breun
Copy link
Author

breun commented Mar 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment