如何从命令行查看文档?

rɑː*_*dʒɑ 6 command-line doc

正如我在那里提到的,如何从命令行查看文档(例如:.doc、.docx 和所有其他格式)?有什么办法吗?

谢谢你。

don*_*oey 11

我一直在几个脚本中使用以下设置(尤其是版本控制):

sudo apt-get install unoconv odt2txt     # installs both tools
doc2odt test.doc                         # creates test.odt
odt2txt test.odt                         # displays the contents in the terminal
Run Code Online (Sandbox Code Playgroud)

或对于 docx 文件:

docx2txt test.docx                       # converts docx file
less test.txt                            # read the contents
Run Code Online (Sandbox Code Playgroud)

像魅力一样工作,您可以在终端中阅读您的文档文件。这种方法比catdoc书目管理系统中的条目不以其原始形式显示更复杂,但它的优点是。

对于 LaTex 文件,您可以使用自己喜欢的终端文本编辑器来打开和阅读它。


rɑː*_*dʒɑ 5

为了从命令行查看 word 文档,我发现了一个名为 catdoc 的文档。

安装它 sudo apt-get install catdoc

然后

catdoc -t filename.doc
Run Code Online (Sandbox Code Playgroud)

您可以使用 -a(文本)或 -t(LaTeX)选项指定输出格式