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:
sudo apt-get install odt2txt
For basic usage, you just need to pass the filename as parameter:
This is a test
But there are also a few more options:
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.