Ask Your Question
1

Is there a command line tool to convert documents to plain text files? [closed]

asked 2012-04-03 10:46:48 +0200

TWmailrec gravatar image

updated 2014-06-10 21:55:07 +0200

bencomp gravatar image

Is there a console app (ie command line) to convert standard document types to .txt file? Also, can .docx be converted?

Would it be necessary for users to have LbreOffice installed?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-25 00:09:36.071101

2 Answers

Sort by » oldest newest most voted
2

answered 2013-01-24 09:50:07 +0200

qubit gravatar image

Hi @TWmailrec,

You may use LibreOffice on the command line to convert various document types to plaintext. Note that plaintext doesn't have any special formatting, so you'll want to experiment with some of your more complicated documents to see how cleverly things like bullets, tables, images, etc... are handled.

To convert a document to text, first make sure that LibreOffice isn't currently running, then use the following on the commandline:

soffice --headless --convert-to txt:Text YOUR-DOCUMENT-HERE.DOC

(I've been told that on Windows you should use "-convert-to" instead of "--convert-to"; I'm not sure if the same applies to the "--headless" parameter)

For more information about using LO on the commandline, see the answers to this question:

edit flag offensive delete link more
2

answered 2012-04-03 14:04:46 +0200

luyu gravatar image

updated 2012-04-03 14:06:48 +0200

In GNU/Linux there is command line program odt2txt which converts odt (OpenDocument Text), ods (OpenDocument Spreadsheet), odp (OpenDocument Presentation) and sxw (OpenOffice.org XML) to txt.

To use it, you don't need to have LibreOffice installed.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-04-03 10:46:48 +0200

Seen: 13,911 times

Last updated: Jun 10 '14