Literary Spoonerism fun with awk



I read the news today, oh boy. About Natasha Kaplinski, who "wedded her banker." What a phrase for the cunning linguistic! I'm sure the journalist in question knew what (s)he was doing. But it did get me thinking as to how many words had common stems, and which could be used for Spoonerisms.

Well, a few moments in my trusty bash shell, and I came up with this perfunctory piece of Spoonerism code:

( (egrep "^w.*" /usr/share/dict/words | awk '{ printf( "b%s\n",substr($0,2))}') && (egrep "^b.*" /usr/share/dict/words)) | sort -f | uniq -d -i

This produces a list of 328 words that may start with either 'b' or 'w', such as "bring" (valid also as "wring"), "bangle" (or "wangle") or "bounds" (with "wounds"). None of them as amusing as the original, granted, but a useful tool for any Ronnie Barker wannabes.

Of which, I am one.