How can I concatenate multiple docx files

Hi. After struggling with this for a couple days, time to ask for help.

I run Linux Mint 18. I have a folder full of documents that I can edit fine in LibreOffice 5 with a .docx extension. I wish to concatenate these together. LibreOffice provides no way to combine these other than one at a time, manually. I went to the command line and used the following command:

cat file1.docx file2.docx >> new.docx.

Shockingly, this does NOT work. It is clear from the size of the resultant file that all the input files are there. However, I can only see one of them (the last one, I think) when I edit it in LibreOffice. I suppose I am naive to think this should work. I have searched the internet for an alternative. I find nothing (that I can understand). Is there another way to combine these files?

3 Answers

cat cannot work because word processor files are not plain text. They contain a lot of housekeeping data (think of it like a dictionary or a small database).

Have you tried setting up a master document?

A master document "includes" other documents based on file names. You just describe which one you want in the master. They stay independent from the master (meaning they are not physically merged into the master, there is only a "pointer").

You are encouraged to read the Writer manual.

Note:

You may stumble on little difficulties with master/slave documents. To decrease this risk, switch to .odt native format for included files.

If this is the answer you're looking for, please accept it by clicking on the check mark at left.

I initially rejected a master document out of hand - not because I am familiar with it but because my final goal is to create a single document that I can import into a different application. The last comment added, however, seems to imply I can do this, so I will give it a try next time I have to do it.

30Mar2017: Took me a while to check this out. As a test, I took several stand alone .odt documents and combined them together as a master document. Then, I exported the result to another stand alone .odt document. Seemed to work well. I intend to use this technique going forward.

Comments

Including the docs in a master doc can be done by selecting multiple docs at once.
Once you export to ODT file you can break the links to the sub-docs and truly have one doc.
Click somewhere not in a sub-doc and then go into links and delete the links to the sub-docs.
Now you have one doc.