You are here

LibreOffice Convert to Plain Text

Error message

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in drupal_strip_dangerous_protocols() (line 1458 of /home2/crephoto/public_html/techblog/includes/common.inc).

LibreOffice is a great suite of software for your standard "office" needs - Text documents, spreadsheets, presentations, and so on. Occasionally, I find the need to make a LibreOffice text document (odt) searchable via command-line tools such as grep. Since the ODT format is actually a package (somewhat like a zip file), it is not directly searchable. Fortunately, the authors provided a solution for this need. The syntax is simply:

$ soffice --headless --convert-to txt:Text TEXT_DOCUMENT.odt

LibreOffice will run without the GUI front end and create a file named TEXT_DOCUMENT.txt