Let’s say you have edited a file in LibreOffice Writer, but later you access your computer remotely via SSH for example. You don’t really want to bother copying the file to your current machine, and rather just quickly check its content in the terminal. Is there a way?
Since odt files are just some zip files containing XML files, you could manually decompress the file, and open XML files, but there is a more convenient the program is called odt2txt. On an Ubuntu / Debian machine it can be installed with:
1 |
sudo apt-get install odt2txt |
For basic usage, you just need to pass the filename as parameter:
1 2 3 |
odt2txt test.odt This is a test |
But there are also a few more options:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
odt2txt odt2txt 0.4 Converts an OpenDocument or OpenOffice.org XML File to raw text. Syntax: odt2txt [options] filename Options: --raw Print raw XML --encoding=X Do not try to autodetect the terminal encoding, but convert the document to encoding X unconditionally To find out, which terminal encoding will be used in auto mode, use --encoding=show --width=X Wrap text lines after X characters. Default: 65. If set to -1 then no lines will be broken --output=file Write output to file, instead of STDOUT --subst=X Select which non-ascii characters shall be replaced by ascii look-a-likes: --subst=all Substitute all characters for which substitutions are known --subst=some Substitute all characters which the output charset does not contain This is the default --subst=none Substitute no characters --version Show version and copyright information |
This also wrote with ods (spreadsheets) and odp (presentations) files with ods2txt and odp2txt which are just symlinks pointing to the same program as odt2txt, namely odt2txt.odt2txt.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
odt2txt can also be used to diff documents stored in git.
https://git.wiki.kernel.org/index.php/GitTips#How_to_use_git_to_track_OpenDocument_.28OpenOffice.2C_Koffice.29_files.3
Openoffice has a headless mode too – not sure exactly what you can do with it: $ soffice –help LibreOffice 4.2.7.2 420m0(Build:2) Usage: soffice [options] [documents…] Options: –minimized keep startup bitmap minimized. –invisible no startup screen, no default document and no UI. –norestore suppress restart/restore after fatal errors. –quickstart starts the quickstart service –nologo don’t show startup screen. –nolockcheck don’t check for remote instances using the installation –nodefault don’t start with an empty document –headless like invisible but no userinteraction at all. –help/-h/-? show this message and exit. –version display the version information. –writer create new text document. –calc create… Read more »