Skip to content

Instantly share code, notes, and snippets.

@charmander
Last active August 29, 2015 14:04
Show Gist options
  • Save charmander/240f362de2f4cfb8dc1f to your computer and use it in GitHub Desktop.
Save charmander/240f362de2f4cfb8dc1f to your computer and use it in GitHub Desktop.
Finds interesting combinations of words for use with sed.
test -z "$1" && echo "Usage: $0 <word list>" && exit 1
grep -P '^s(.)(?:(?!\1).)*\1(?:(?!\1).)*\1[gimp]*$' "$1" \
| awk '{ print length, $0 }' | sort -rn | cut -d\ -f2- \
| while read line
do
echo $line
sed -n "${line}p" "$1" | sort | diff -u "$1" - | grep -v '^[@+-]'
done 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment