Merge two HTML files into master HTML file

Your example files are well-formed XHTML. Excellent! This means you can use a simple XSLT script. See How to merge two XML files with XSLT


Use pandoc to merge e.g. all html-files in the current directory:

pandoc -s *.html -o output.html

You can use html-merge tool to merge multiple HTML files preserving their internal hypertext links. It's a win32 program, but you can run it in linux using Wine. Download page: https://sourceforge.net/projects/htmlmg/files/