Created
October 27, 2022 17:27
-
-
Save andrewgho/bd6ec8f32ebcdad59860ce524a94b515 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
# bee - return Spelling Bee words from maximal set | |
# Andrew Ho <[email protected]> | |
ME=`basename "$0"` | |
USAGE="usage: $ME letters middle-letter" | |
die_usage() { (echo "$ME: $@"; echo "$USAGE") 1>&2; exit 1; } | |
letters="$1" | |
[[ -z "$letters" ]] && die_usage 'missing required letters' | |
middle="$2" | |
[[ -z "$middle" ]] && die_usage 'missing required middle letter' | |
pcregrep -hi "^[$letters]{4,}$" \ | |
~/work/wordchomp/ospd3.txt \ | |
/usr/share/dict/words | | |
fgrep -i "$middle" | | |
sort -fu | | |
awk '{ print length, $0 }' | | |
sort -n | | |
cut -d' ' -f2- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment