dw filters its standard input, printing on standard output only those words which appear twice in succession. Each word is prefixed by its line number(s).
A word starts with a letter or underscore, and is followed by zero or more letters, underscores, or digits. Letter case is ignored.
This is a handy tool for finding a common typographical error in documentation.
Its other purpose is to demonstrate a reasonably short lex(1) program.