返回列表 发帖

坛主能否介绍一下powerGREP的用法

我一直想用powerGREP搜索word等文件中的字符,可是软件总是提示无法打开。看了帮助,大意是说doc文档是加密文档,可能打不开。但这款软件还是支持doc和docx的吗?且docx是公开文档格式,powerGREP也打不开。这是什么原因呢?我用的powerGREP是最新demo版。

TOP

RE: 坛主能否介绍一下powerGREP的用法

我看了一下powergrep官方文档,如下:
With PowerGREP, you can quickly search for a piece of information through files and folders on your computer, including Microsoft Word documents saved in DOC, DOT and DOCX files. Simply type in a keyword or phrase in the Search box, select which folder PowerGREP should go through and which types of files are of interest. When you click the search button, PowerGREP will present you with a list of MS Word documents and other files in which the text you entered in the search box was found. The list will show one line of context for each match. You can instantly inspect the entire context by double-clicking on the match in the results.

使用PowerGREP,您可以快速在MS文档中搜索信息。支持的文件格式有DOC,DOT,以及DOCX。...(搜索方法与其它文档相同,略过不译。)

Prior to Office 2007, Microsoft Word used a proprietary file format to store its documents. These files have a .doc or .dot extension. The file format is not documented officially. Because the file format is very complex, most applications that can handle Word documents rely on Microsoft Word itself.

Office2007之前的MS Word使用私有格式存储文件。这些文件的后缀为doc或dot。这种文件格式并没有官方文档加以阐释。鉴于该文件格式异常复杂,许多处理word文档的程序都依赖MS Word本身来完成。

Since PowerGREP needs to be able to search through a large number of files in a reasonable amount of time, running Microsoft Word in the background is not an option. Instead, PowerGREP will open the DOC file directly, without the help of MS Word, and extract the text from the file. Text formatting, images and other special content are ignored. The extracted text is what PowerGREP searches through. When inspecting search matches inside PowerGREP, the built-in file editor will show the plain text version that PowerGREP actually searched through. You can always click use the Edit button's drop-down menu to open the file in Microsoft Word.

由于PowerGREP需要在不占用大量处理时间的情况下搜索大量文件,因此在后台运行MS Word的方法就不可取了。相反,PowerGREP直接打开DOC文件,析取里面的文本,而不借助于MS Word的帮助。文本格式、图片,以及其它内容均忽略不计。析取出的文本才是PowerGrep进行搜索的对象。在PowerGREP内部检测匹配时,内置的文本处理器列出PowerGREP进行实际搜索所用的普通文本。您可以随时使用Edit按钮中的下拉菜单,以便使用MSword打开该文档。

PowerGREP is not able to modify DOC files. You cannot search-and-replace through DOC files using PowerGREP. If you want to modify Word document with PowerGREP, consider switching to the DOCX format.

PowerGREP 不能修改DOC文档,不能对该文档使用搜索-替换功能。如果你想使用PowerGREP来修改WORD文档,请考虑将其转换为DOCX格式。


我使用的PowerGREP为3.3.3完全版。我电脑上装的是金山WPS2007,没有装MSWord。

我试了一下,使用PowerGREP在word中,excel,以及PDF中都能搜索文件内容。不过,在pdf/excel中,可以搜索中文内容,但是在word文件中,只能搜索英文内容。估计与编码格式有关。

谈及编码格式,不知中文word内置的编码是什么。在Powergrep的powergrep->preference->text encoding中,可以设置某类文档的默认格式。我测试为msword分别使用windows 936以及unicode utf8,均不成功。看来是msword的文本格式太怪异了。

PowerGREP can search and even replace through Microsoft Office Open XML files (*.docx). These files are technically .zip archives containing one or more XML files and other supports files (such as image files). PowerGREP cannot interpret the XML formats to display a formatted page like Microsoft Word does. PowerGREP will display and search through the raw XML. Both the XML tags and the actual content of the document will be searched through.

PowerGREP可以对MS OFFICE OPEN XML文档(*.docx)进行搜索乃至替换操作。准确地说,此类文档其实是由zip打包的一个或一些XML文档以及其它支持文件(例如图片文件)。PowerGREP不能像MS Word那样将XML文件翻译转换为格式化的文档,而只是对原始XML文件进行搜索操作。搜索时,XML tags和实际内容都在搜索的范围之内。


我将docx文件解压后,在word文件夹下发现document.xml文件。该文件docx文件的核心内容,它是以utf-8编码的。因此,在PowerGrep中指定使用UTF-8格式打开该文件。此时搜索中文、英文,效果都很好。经测试,替换也没问题。
在答疑解惑版提问时,请注明所用语言、范例文本、匹配结果。谢谢!
------------------------------------------------------------------------------
我爱正则表达式
GTalk: rex[at]zhasm[dot]com
Twitter: rex_zhasm

TOP

RE: 坛主能否介绍一下powerGREP的用法

斑竹的介绍很好,现在正在找DOC文档内容批量替换的方法,PowerGREP不支持中文,有点可惜。

TOP

RE: 坛主能否介绍一下powerGREP的用法

试试转成docx格式?
在答疑解惑版提问时,请注明所用语言、范例文本、匹配结果。谢谢!
------------------------------------------------------------------------------
我爱正则表达式
GTalk: rex[at]zhasm[dot]com
Twitter: rex_zhasm

TOP

RE: 坛主能否介绍一下powerGREP的用法

[quote='rex' pid='430' dateline='1254186539']
试试转成docx格式?
[/quote]

单纯为了替换安装word 2007似乎不怎么划得来,况且Powergrep也不是免费的。:s

TOP

提示: 作者被禁止或删除 内容自动屏蔽

TOP

返回列表