Shell – Write shell output to MS Word document

libreofficeshell-scripttext processingtext;

Problem:

I usually output text from my shell to file using >. I am trying to find an equivalent process that outputs a MS Word document (.doc or .docx).

I was thinking to use libreoffice and came up with this using the convert-to command:

echo "texthere" > tt.txt;   soffice --convert-to doc tt.txt

That is, I am first creating a plain txt document and then convert it to doc in a second step.

Question: Is there a one-step solution?

E.g. along the lines of:

echo "texthere" | command_to_output_as_doc filename.doc

Thanks! (I'm using GNU bash, version 4.3.48(1) on Elementary OS)

Best Answer

I believe you might be able to use pandoc. It reads from stdin and can output to a variety of formats

Related Question