【问题标题】:How to install catdoc on Mac (without using macports)如何在 Mac 上安装 catdoc(不使用 macports)
【发布时间】:2017-05-16 14:04:33
【问题描述】:

背景

我真的很想在一个满是 Word 文档的目录中搜索一个词。所以我偶然发现了这个lovely solution。但是,此解决方案要求在 mac 上安装 catdoc。

我尝试过的

现在自制软件显然没有 catdoc:

$ brew install catdoc
Updating Homebrew...
Error: No available formula with the name "catdoc"
==> Searching for a previously deleted formula...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.

macports 可以,但我使用的是自制软件,我的机器上不是 good idea

所以我做了任何有自尊的半程序员都会做的事情:尝试从source安装它:

$ ./configure 

outpout

$ ./make

output

./make 的最后一部分给了我这个

1 warning generated.
gcc -o catppt catppt.o pptparse.o charsets.o substmap.o fileutil.o confutil.o numutils.o ole.o  -lm
echo "#! /usr/bin/wish" >wordview
echo set charset_lib "\"/usr/local/share/catdoc\"">>wordview
cat wordview.tcl >>wordview
chmod 0755 wordview
touch build
make[1]: Nothing to be done for `all'.

然后当我运行make install 时,我得到了这个

make: `install' is up to date.

显然 catdoc 不起作用:

$ which catdoc
>> nothing

问题

如何安装?

【问题讨论】:

    标签: macos makefile gnu-make


    【解决方案1】:

    您可以使用内置的 textutil 将 MS-Word 文档转换为文本:

    textutil -stdout -cat txt SomeFile.doc 
    

    textutil -stdout -cat txt *.doc 
    

    【讨论】:

    • 好东西!那我怎么能对pdf文件做同样的事情呢? (已获得正确答案,!featureCreep)
    • 您可以使用 Automator 制作一个小脚本,从 PDF 中提取文本 - 我大约 10 周前完成了它,然后删除了它,因为我认为它不会有用:-) 这应该让你开始engadget.com/2013/02/11/…
    • @abbood:对于 pdf,您需要 pdftotext — 在 macos 上,您可以使用 brew install poppler 获得它
    【解决方案2】:

    在 Mac OS X (macos) 上构建 catdoc / catppt / xls2csv

    在 Mac OS X 10.9.5 上使用 catdoc-0.95 测试

    配置

    首先,除非您的文档可能是用西里尔语编写的,否则请以:

    $ ./configure --with-input=cp1252 --with-output=mac-roman

    (如果您更有可能遇到来自 Windows 的文件)

    ...或...

    $ ./configure --with-input=mac-roman --with-output=mac-roman

    (如果您更有可能遇到来自 MacOS 的文件)

    建筑

    $ make all(或只是 $ make

    安装

    make --directory=src install; make --directory=doc install; make --directory=charsets install
    

    这应该可以弥补您收到的错误,abbood 由于某种原因,主 Makefile 似乎没有运行三个子目录的安装部分。如果报告权限错误,请在上述命令前加上“sudo”。

    我不认为这应该是必要的,但我对 makefile 不够熟悉,无法提供更合适的(教科书)修复。


    当然,可以通过以下方式获得相同的效果:

    $ cd src
    $ make install
    $ cd ../doc
    $ make install
    $ cd ../charsets
    $ make install
    $ cd ..
    

    清理

    要删除make 创建的所有文件,请输入:

    • $ make clean

    要删除make 以及./configure 创建的所有文件,请键入

    • $ make distclean

    【讨论】:

      猜你喜欢
      • 2013-12-26
      • 1970-01-01
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 2010-09-14
      • 2015-04-03
      • 2012-12-14
      • 1970-01-01
      相关资源
      最近更新 更多