What you need is a
regular expression search & replace. You can do that with
TextWrangler. Just open your document with the table in TextWrangler, Search menu -> Find. Check the box that says Use Grep. In the top (search) box you'll enter the pattern you want to match. In the bottom (replace) box you enter the pattern to replace with.
You need to be a little more specific about how you want to generate the URLs, but from your example I am thinking you probably want to search for every <TD></TD> pair that has something in it, then take the extension and craft it into the url: <a href="viewer.htm?{EXTENSION}={FILENAME}.{EXTENSION }">{FILENAME}.{EXTENSION}</a>
If that's right try this:
Search for: <td.*>(.+)\.(.+)</td>
Replace with: <a href="viewer.htm?\2=\1.\2">\1.\2</a>