#!/bin/bash sed 's/ = .*$//' < a-list-of-anagrams | \ tr '[A-Z]' '[a-z]' | \ awk ' { print length(gensub(" ", "", "g", $0)), $0 }' | \ sort -n