How to merge odt documents from the command line?

7,754

I had time to have a go at @Rinzwind's mentioned ooopy - to install it, download the latest version from here, then extract it and run the setup.py as mentioned here - or just run these commands to install the currently latest version 1.11:

wget http://downloads.sourceforge.net/project/ooopy/ooopy/1.11/OOoPy-1.11.tar.gz
tar -xf OOoPy-1.11.tar.gz
cd OOoPy-1.11/
sudo python ./setup.py install

You can then use it like this:

ooo_cat file1.odt file2.odt file3.odt > file123.odt

this may also work:

ooo_cat file1.odt file2.odt file3.odt -o file123.odt

I have only tried it with three ODTs with small amounts of text.

Share:
7,754

Related videos on Youtube

don.joey
Author by

don.joey

Before I was called Private, but due to namespace polution I am henceforth known as don.joey! For my real avatar (.gif): check here.

Updated on September 18, 2022

Comments

  • don.joey
    don.joey over 1 year

    I have a large number of odt reports in one folder.

    How can I merge them into one odt document from the command line?

    I have found that this was possible in ooo_cat, but that seems deprecated (or at least I don't know where to start to use it).

    Is it possible to merge odt documents from the command line? Does ooo_cat do the trick, if so, how can I install and use it?

    • Rinzwind
      Rinzwind almost 10 years
      also see ooopy.sourceforge.net :) what python version are you using? ;)
    • don.joey
      don.joey almost 10 years
      @Rinzwind Of course I've read that as well as sourceforge.net/projects/ooopy, but I cannot find easy install and use instructions (also for future reference).
    • don.joey
      don.joey almost 10 years
      @Rinzwind python 2.7.6 and 3.4.0.
    • don.joey
      don.joey almost 10 years
      Also I want to avoid conflict between OO and LO.
    • Admin
      Admin almost 10 years
      Try with libreoffice --print-to-file [OUTPUT FILE HERE] *.odt
    • hytromo
      hytromo almost 10 years
      What about the messy all odts to txts, cat all txts into one txt and convert that txt to odt?
    • don.joey
      don.joey almost 10 years
      @hakermania actually it is possible with pdf: convert all odt documents to pdf, then merge the pdfs, but that does not make the document editable. Converting to txt discards too much formatting.
    • hytromo
      hytromo almost 10 years
      You can't convert the pdf back to odt?
    • Panther
      Panther almost 10 years
      See ask.libreoffice.org/en/question/19222/… or perhaps ask there as well.
    • Wilf
      Wilf almost 10 years
      @Rinzwind - almost right there - the recent versions should work with Python 2.7, the problem is quite alot of the available versions seem to need the almost ancient Python 2.6 installed ... If searching for packages, you seem to need to search for python-ooopy
    • Admin
      Admin almost 2 years
      @user224082 this seems to just convert all files to pdf
  • Andy J
    Andy J over 8 years
    Ubuntu 14.04 and Python 2.7.6. Gave it a whirl with 25 separate one-page .odt documents, and it went well up until about page 16, where the formatting got all messed up after that.
  • Wilf
    Wilf over 8 years
    @Andy - u could report it as a bug, or try merging them in smalls groups (say 5), and then merging those resulting groups.