I have multiple HTML files for this book. I am trying to add them in opposite order.

I've tried:

 cat *.html >> merge.html

I've tried to use tac on the list of downloaded files by time to no avail:

tac $(ls -t) >> output_file.html

When I open up the file, it continually seems to flash and pages are missing.

lcd047 recommended below that I use htmldoc. When following the installation, I run into the following error:

make: *** No rule to make target `ENTER'.  Stop.

When I try to run it in command line on the document download from here, I run into this issue:

ERR011: Unable to parse HTML element on line 2011 of intro.html!
BYTES: 39062
  • Could you be more specific on what you're trying to achieve? Are you trying to combine multiple pages into one long HTML document?
    – Erathiel
    Commented Jun 1, 2015 at 13:30
  • I'm trying to combine multiple HTML files (chapters) into a single long HTML document (book) Commented Jun 1, 2015 at 13:32
  • 5
    It won't work. HTML language defines a structure called DOM (Document Object Model) for a single page. Merging HTML files to make a big one is like trying to build a limousine crashing one car into other.
    – jcbermu
    Commented Jun 1, 2015 at 13:36
  • If ls -t gives the direct order, you could try cat $( ls -t | tac ) >>output.html. But beware that cat doesn't deal with HTML headers and the like. A better solution might be to use something like HTMLDOC or Sigil.
    – lcd047
    Commented Jun 1, 2015 at 13:39
  • @lcd047 when I try to run "make install ENTER" as part of the htmldoc tutorial, I run into this error...make: *** No rule to make target `ENTER'. Stop Commented Jun 1, 2015 at 15:12

1 Answer 1


When you "cat" files together, you're going to end up with extra markup you don't need. Notably, you'll have <html> and </html> tags, which will screw up your rendering. You'll also have multiple <head> sections. Those pages don't look like they use Javascript, but I didn't check closely - colliding Javascript namespaces can also screw you up with this approach.

For such a small set of HTML pages, you're probably best off doing this by hand, or creating a merged HTML (CHM) file. However, there are other ways to accomplish this:

  • The first link has pointers to some very interesting tools, thank you.
    – lcd047
    Commented Jun 1, 2015 at 14:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .