Combine Several .doc Files to One?

Message
Author
User avatar
NevilsStation
Posts: 304
Joined: Sun Feb 26, 2017 3:09 pm

Combine Several .doc Files to One?

#1 Post by NevilsStation »

Is there a simple program somewhere that will combine multiple .doc files in a folder into one, please?

I've tried

Code: Select all

cat *.doc > bigfile.doc
and

Code: Select all

find . -maxdepth 1 -type f -name "*.doc" -print0 | xargs -0 cat > bigfile.doc
but in both cases bigfile.com only displays one of the documents (even though the file that's created is the right size to host them all).

Thanks!
Custom-built PC w/i7 CPU running MX-16.

User avatar
Jerry3904
Administrator
Posts: 21939
Joined: Wed Jul 19, 2006 6:13 am

Re: Combine Several .doc Files to One?

#2 Post by Jerry3904 »

I do it this way:

Code: Select all

cat text1 text2 text3 > bigtext
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
Richard
Posts: 1577
Joined: Fri Dec 12, 2008 10:31 am

Re: Combine Several .doc Files to One?

#3 Post by Richard »

Thanks.
Good to know.
Thinkpad T430 & Dell Latitude E7450, both with MX-21.3.1
kernal 5.10.0-26-amd64 x86_64; Xfce-4.18.0; 8 GB RAM
Intel Core i5-3380M, Graphics, Audio, Video; & SSDs.

User avatar
NevilsStation
Posts: 304
Joined: Sun Feb 26, 2017 3:09 pm

Re: Combine Several .doc Files to One?

#4 Post by NevilsStation »

Jerry3904 wrote: Thu Oct 11, 2018 1:20 pm I do it this way:

Code: Select all

cat text1 text2 text3 > bigtext
I will try that - I saw it but had ignored it in favor of using a wildcard.

I'm trying to avoid having to type in the names of every file ... sometimes there may be dozens of them.

Why doesn't a wildcard work, please?
Custom-built PC w/i7 CPU running MX-16.

User avatar
NevilsStation
Posts: 304
Joined: Sun Feb 26, 2017 3:09 pm

Re: Combine Several .doc Files to One?

#5 Post by NevilsStation »

No joy.

bigfile is the correct size for the two named files I specified but only the content of one of the originals is displayed when it's opened.

This is very odd ...
Custom-built PC w/i7 CPU running MX-16.

old_guy
Posts: 140
Joined: Sat Oct 28, 2017 4:30 pm

Re: Combine Several .doc Files to One?

#6 Post by old_guy »

NevilsStation
That won't work. The unix/linux commands like cat work with plain text files .Your .doc files have many many format commands included that can't be handled. To see, try to open one of your .doc files in featherpad.
You will have to cut/paste the contents of each .doc file into one new .doc file.
Earl

User avatar
fehlix
Developer
Posts: 10375
Joined: Wed Apr 11, 2018 5:09 pm

Re: Combine Several .doc Files to One?

#7 Post by fehlix »

@NevilsStation,
you can concatenat text files (aka "ascii" text files),
but you can't concatenate word-doc files to create a valid doc file.

What I would do:
- convert the doc to LibreOffice odt-files as show in this example:
( needs unoconv to be installed )

Code: Select all

unoconv -f odt -o my_odt_dir  *.doc
- convert the xml-based odt-files into one big odt-LO-file
using OOoPy from here: https://sourceforge.net/projects/ooopy/
extract and install like this

Code: Select all

  sudo python ./setup.py install    
and merge/concatenate odt-files like this:

Code: Select all

  ooo_cat --output-file my_big.odt  file1.odt file2.odt file3.odt 
# or
  ooo_cat --output-file my_big.odt  *.odt 
Sure some formating might be lost during convertion from doc to odt.
If you only interested int the "Text" without formatiing just convert doc to txt

Code: Select all

  unoconv -f txt -o my_txt_dir  *.doc
and use

Code: Select all

cat *.txt > my_big_txt_file.txt
:puppy:
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

clicktician
Posts: 136
Joined: Sat May 02, 2015 4:35 pm

Re: Combine Several .doc Files to One?

#8 Post by clicktician »

fehlix wrote: Thu Oct 11, 2018 3:48 pm If you only interested int the "Text" without formating just convert doc to txt
Very useful. I wish we still had the "thank" button on posts.
Son, someday all this will belong to your ex wife.

User avatar
Jerry3904
Administrator
Posts: 21939
Joined: Wed Jul 19, 2006 6:13 am

Re: Combine Several .doc Files to One?

#9 Post by Jerry3904 »

You can also open one in LibreOffice, and repeatedly click Insert > Text from File. Then save as a new document.

Obviously not useful when there are zillions...
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
NevilsStation
Posts: 304
Joined: Sun Feb 26, 2017 3:09 pm

Re: Combine Several .doc Files to One?

#10 Post by NevilsStation »

Lots to try a bit later ... when I've lost daylight.

Question: The purpose of this exercise is to create an epub and/or other ebook format.

Each file is a chapter in a book of seven chapters.

Is there a program I can just point at the folder & which will can handle that, or
do I in any case have to concatenate them into a single file - with formatting
intact?

Thanks!
Custom-built PC w/i7 CPU running MX-16.

Post Reply

Return to “General”