Here is a C program one of our old-time sysadmins wrote to collapse word lists:
http://pirlwww.lpl.arizona.edu/~mmilazzo/lq/cwl.tgz
It comes with a section 1 man page so you can place the *.1 file in your manpath under cat1 (/usr/man/cat1). You'll have to compile the program, but it should just work. IMHO, it needs a lot of work, but it does do its job right now.
This only removes repeated paths, but with a little work it could be a much more useful program. . .