6

Microsoft Word ドキュメントを比較する方法については、こちらのガイドに従っていますが、次のエラーが発生しました。

Usage:  /usr/bin/docx2txt.pl [infile.docx|-|-h] [outfile.txt|-]
        /usr/bin/docx2txt.pl < infile.docx
        /usr/bin/docx2txt.pl < infile.docx > outfile.txt

        In second usage, output is dumped on STDOUT.

        Use '-h' as the first argument to get this usage information.

        Use '-' as the infile name to read the docx file from STDIN.

        Use '-' as the outfile name to dump the text on STDOUT.
        Output is saved in infile.txt if second argument is omitted.

Note:   infile.docx can also be a directory name holding the unzipped content
        of concerned .docx file.

fatal: unable to read files to diff

どのようにしてそのエラーが発生したかを説明するには、差分を作成したいリポジトリに .gitattributes を作成しました。.gitattributes は次のようになります。

*.docx diff=word
*.docx difftool=word

docx2txt をインストールしました。私はLinuxを使用しています。これを含むdocx2txtというファイルを作成しました:

#!/bin/bash
docx2txt.pl $1 -

私は$ chmod a+xdocx2txtを作成し、docx2txtを/usr/bin/に配置しました

やった:

$ git config diff.word.textconv docx2txt

次に、2 つの Microsoft Word ドキュメントを比較しようとしました。そのとき、上記のエラーが発生しました。

私は何が欠けていますか?このエラーを解決するにはどうすればよいですか?

PS: シェルが docx2txt を見つけることができるかどうかはわかりません。

$ docx2txt

私の端末はフリーズし、何かを処理しますが、何も出力しません。これらのコマンドを実行すると、次のようになります。

$ man docx2txt
No manual entry for docx2txt
$ docx2txt --help
Can't read docx file <--help>!

進行状況の更新: docx2txt を次のように変更しました

#!/bin/bash
docx2txt.pl "$1" -

pmod が提案したようにgit diff <commit>、コマンドラインから動作するようになりました! わーい!しかし、試してみると

$ git difftool <commit>

git が kdiff3 を起動すると、次のポップアップ エラーが表示されます。

Some input characters could not be converted to valid unicode.
You might be using the wrong codec. (e.g. UTF-8 for non UTF-8 files).
Don't save the result if unsure. Continue at your own risk.
Affected input files are in A, B.

...そして、ファイル内のすべての文字は巨大ジャンボです。コマンドラインは差分テキストを正しく表示しますが、何らかの理由で kdiff3 は差分からのテキストを正しく表示しません。

kdiff3 または別の GUI ツールで差分のテキストを正しく表示するにはどうすればよいですか? kdiff3 を別のツールに変更する必要がありますか?

エクストラ:次のコマンドのために、私のシェルはdocx2txtを見つけることができないようです:

$ which doctxt
which: no doctxt in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

$ which docx2txt
/usr/bin/docx2txt
4

2 に答える 2