You could run through all the pages file by file, searching for the <a > </a> tags and extract them to a database. That is probably the most effective if they are carried as part of flat rather than dynamic pages.
It is worth thinking about using a database to carry your list of links to start with. That makes it a little easier to check they are all live and correct because you can update them once and the update appears on every page where that link exists.