Skip to content

Instantly share code, notes, and snippets.

@gedsic
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save gedsic/7544e28f6659a8c7dcf4 to your computer and use it in GitHub Desktop.

Select an option

Save gedsic/7544e28f6659a8c7dcf4 to your computer and use it in GitHub Desktop.
For a given sequence of letters, retrieve one random dictionary word starting with each letter
for letter in {h,o,r,s,t}; do grep -i "^$letter.*[^e|en|em|er|et|est|ging]$" /usr/share/dict/ngerman | perl -e '@lines = <>; print $lines [ rand @lines ]'; done
Example output (german):
hinauszögernd
ostafrikanisch
rundend
Scheidewand
Textmaterial
Remove the -i from grep to use a case sensitive search. In german, that leads to nouns being excluded and you end up with mostly adjectives and participles. Example:
haltend
obwaltend
rau
schmeichelnd
tagesaktuell
English example:
> for letter in {h,o,r,s,t}; do grep -e "^$letter.*[^'s]$" /usr/share/dict/american-english | perl -e '@lines = <>; print $lines [ rand @lines ]'; done
handicraft
oath
reliability
schmuck
testified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment