The docx2txt is a command line tool that allows to convert MS Word (DOCX) files to plain text files while preserves some formatting. This tool requires the Perl interpreter.
This tutorial demonstrates how to install docx2txt on Raspberry Pi.
Use SSH to connect to Raspberry Pi. Run the following commands to update the package lists and install docx2txt:
sudo apt update sudo apt install -y docx2txt
Now download DOCX file from the Internet for testing:
wget -O test.docx https://raw.githubusercontent.com/dbashford/textract/master/test/files/docx.docx
docx2txt command to convert DOCX file to plain text file:
docx2txt test.docx test.txt
We can view the content of a file:
This is a test Just so you know: ...........
It is possible to write results to standard output by specifying a dash (
-) as the output file name:
docx2txt test.docx -
If the docx2txt is no need anymore, you can remove it with command:
sudo apt purge --autoremove -y docx2txt