|
grep Targetgrep" to search the files in a
directory for a certain string or pattern, and returns the files as
records.
To use the grep target, simply build gazelle with it. Go to the top level of the gazelle distribution and type
% make grep
The targets/grep directory contains a very simple example
configuration file called grep.xml, which looks like
this:
<config>
<param name="port" value="2210"/>
<param name="type" value="forking"/>
<param name="debug" value="true"/>
<param name="debugLog" value="debug.log"/>
<param name="accessLog" value="access.log"/>
<param name="errorLog" value="error.log"/>
<!-- put the name of the directory you want to search here.
include the trailing slash. -->
<param name="grep_directory" value="/my/grep/directory/"/>
|
/home/httpd/htdocs directory, this line would read
|
<!-- when you search with zclient, use "grep" as the name
of the database -->
<database name="grep">
<!--
Mapping of z39.50 terms and operators to target expressions.
Currently, each attr or nested attr combination must have a
"term" tag that defines how to build the term (the z39.50
attributePlusTerm) of an expression.
Each attribute may also optionally have a "template" tag which
defines how it is translated.
-->
<!-- For now, we only support attribute 1=1 -->
<attr type="1" value="1">
<term>$value</term>
</attr>
</database>
</config>
|
Select a directory you want to search and edit grep.xml
appropriately. Then start gazelle. Next, try out the grep target
using zclient. Pick a word which you know occurs in at least one
file. Type
% ./zclient -a 1=1 grep word
The grep target should report the number of files which contain that
word. See Using the Gazelle
Client for information on how to use zclient.
For details about how the grep target works, see the
tutorial on how to
develop targets.