我一直在关注本指南,了解如何区分 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+x
docx2txt 我把 docx2txt 放在 /usr/bin/
我做了:
$ git config diff.word.textconv docx2txt
然后试图区分两个微软的word文档。那是我得到上面提到的错误的时候。
我错过了什么?如何解决此错误?
PS:我不知道我的 shell 是否可以找到 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 更改为另一个工具吗?
额外:由于这些命令,我的 shell 似乎无法找到 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