Welcome!
Important information
-- Required MX 15/16 Repository Changes
-- Information on torrent hosting changes
-- Information on MX15/16 GPG Keys
-- Spectre and Meltdown vulnerabilities

News
-- Introducing our new Website
-- MX Linux on social media: here

Current releases
-- MX-18.2 Point Release release info here
-- Migration Information to MX-18 here
-- antiX-17.4.1 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

Combine Several .doc Files to One?

NevilsStation
Forum Regular
Forum Regular
Posts: 297
Joined: Sun Feb 26, 2017 3:09 pm

Combine Several .doc Files to One?

#1

Post by NevilsStation » Thu Oct 11, 2018 1:13 pm

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
Forum Veteran
Forum Veteran
Posts: 24426
Joined: Wed Jul 19, 2006 6:13 am

Re: Combine Several .doc Files to One?

#2

Post by Jerry3904 » Thu Oct 11, 2018 1:20 pm

I do it this way:

Code: Select all

cat text1 text2 text3 > bigtext
Production: 4.15.0-1-amd64, MX-17.1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, SSD 120 GB, Data 1TB
Testing: AAO 722: 4.15.0-1-386. MX-17.1, AMD C-60 APU, 4 GB
Personal: XPS 13, 4.18.0-19.3-liquorix, 4 GB

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

Re: Combine Several .doc Files to One?

#3

Post by Richard » Thu Oct 11, 2018 1:53 pm

Thanks.
Good to know.
LT: MX18.2: Thinkpad T430: DualCore, Intel i5-3320M, Ivy Bridge; 8GB RAM; 4.19.0-5-amd64; 119GB SSD 840PRO, Intel Graphics-Audio-Network
NB: MX18.1, antiX17.4: AsusTek EeePC 1005HA: Intel DualCore Atom N270, 1GB RAM, 4.19.0-1-686, 150GB HDD

NevilsStation
Forum Regular
Forum Regular
Posts: 297
Joined: Sun Feb 26, 2017 3:09 pm

Re: Combine Several .doc Files to One?

#4

Post by NevilsStation » Thu Oct 11, 2018 2:31 pm

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.

NevilsStation
Forum Regular
Forum Regular
Posts: 297
Joined: Sun Feb 26, 2017 3:09 pm

Re: Combine Several .doc Files to One?

#5

Post by NevilsStation » Thu Oct 11, 2018 2:54 pm

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
Forum Novice
Forum  Novice
Posts: 58
Joined: Sat Oct 28, 2017 4:30 pm

Re: Combine Several .doc Files to One?

#6

Post by old_guy » Thu Oct 11, 2018 3:26 pm

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
Forum Veteran
Forum Veteran
Posts: 3758
Joined: Wed Apr 11, 2018 5:09 pm

Re: Combine Several .doc Files to One?

#7

Post by fehlix » Thu Oct 11, 2018 3:48 pm

@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
Forum Regular
Forum Regular
Posts: 227
Joined: Sat May 02, 2015 4:35 pm

Re: Combine Several .doc Files to One?

#8

Post by clicktician » Thu Oct 11, 2018 4:34 pm

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
Forum Veteran
Forum Veteran
Posts: 24426
Joined: Wed Jul 19, 2006 6:13 am

Re: Combine Several .doc Files to One?

#9

Post by Jerry3904 » Thu Oct 11, 2018 4:44 pm

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: 4.15.0-1-amd64, MX-17.1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, SSD 120 GB, Data 1TB
Testing: AAO 722: 4.15.0-1-386. MX-17.1, AMD C-60 APU, 4 GB
Personal: XPS 13, 4.18.0-19.3-liquorix, 4 GB

NevilsStation
Forum Regular
Forum Regular
Posts: 297
Joined: Sun Feb 26, 2017 3:09 pm

Re: Combine Several .doc Files to One?

#10

Post by NevilsStation » Thu Oct 11, 2018 5:41 pm

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”