Since you specifically ask about docx.
One way of handling these files without Office/Word is first add the file extension ZIP and then unzip the file. You get a lot of files, including XML files, which contain one or the other XML format, there's office XML. That's how the tools by Greg Greene can work on such files.
The bad news is, when you expect the xml nodes to contain continuous text, you'll be astonished by how unintuitive a text is encoded just when writing and/or editing/correcting it differently.
I just wrote the sentence "The quick brown fox jumps over the laze dog." and saved that, unzipped the document1.docx.zip (after adding that file extension, of course), and find this in a file document.xml (and that's just a small portion of it):
[pre]<w:bookmarkStart w:name="_GoBack" w:id="0" /><w:bookmarkEnd w:id="0" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t xml:space="preserve">
The quick </w:t>
</w:r><w

roofErr w:type="spellStart" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t>
brown</w:t>
</w:r><w

roofErr w:type="spellEnd" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t xml:space="preserve"> </w:t>
</w:r><w

roofErr w:type="spellStart" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t>
fox</w:t></w:r0>
<w

roofErr w:type="spellEnd" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t xml:space="preserve"> </w:t></w:r><w

roofErr w:type="spellStart" />
<w:r w:rsidR="761ADE2B"><w:rPr /><w:t>
jumps</w:t></w:r><w

roofErr w:type="spellEnd" /><w:r w:rsidR="761ADE2B"><w:rPr />
<w:t xml:space="preserve"> </w:t></w:r><w

roofErr w:type="spellStart" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t>over</w:t>
</w:r><w

roofErr w:type="spellEnd" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t xml:space="preserve"> </w:t></w:r><w

roofErr w:type="spellStart" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t>the</w:t></w:r><w

roofErr w:type="spellEnd" /><w:r w:rsidR="761ADE2B">
<w:rPr /><w:t xml:space="preserve"> </w:t></w:r><w

roofErr w:type="spellStart" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t>lazy</w:t>
</w:r><w

roofErr w:type="spellEnd" /><w:r w:rsidR="761ADE2B"><w:rPr /><w:t xml:space="preserve"> dog.</w:t></w:r></w

><w:sectPr>[/pre]
And sorry, I stopped to color the words that actually are the content of this. You see the difficulty to even drill down to the actual words. If you thought: "Fine, XML may look convoluted with pointy bracket tags all over the place, the actual text would be in tags like HTMLs paragraph tag <p>.
Well, as you see it's not. So even on that level you'll need something to extract the text, do a replace and then put the replaced text back.
I think code that goes the route of generating Office XML from test will actually produce pretty or at least prettier formatted XML than the Word application itself. And when using this to even just extract the actual text without any formatting to work on it, then you see how messy this is.
Chriss