Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home
0 votes

I have a list of keywords which I need to know if they exist in any of the files in a group of directories. I don't care which files the keywords are found in just whether the keyword was found. Is this possible?

by (715 points)

1 Answer

0 votes

I'd recommend using the File List functionality where you can save the keywords in a text file and reference them from the program. This link has a good example of how to use File Lists:

How can I search a list of keywords inside files?

To see the keywords found simply go to the reporting tab and select the Keyword Summary report:

Keywords Summary

FileLocator Pro 6.5 or earlier

For versions of FileLocator Pro prior to version 7 you can still see a list of keywords it's just a little harder. After running the search you can export the unique list of found keywords using a custom format:

  1. Click the File->Export Results... menu option
  2. Select the 'Custom (XSLT)' format option
  3. Browse to the Sample Transforms folder and pick the file: unique_hits_only.xsl
  4. Click the Export button

The unique hits should now be in your file/clipboard.

Counting the hits

If you want a count of the hits you can use a slightly modified version of the custom format. Save the XSL shown below into a text file called 'unique_hit_count.xsl' and select that in the 'Custom (XSLT)' edit box.

<?xml version="1.0"?>
<!-- Hits only Transform with count
    Copyright (C) Mythicsoft Ltd 2012. All rights reserved.
    Produces output that contains just the hits found in a search along with an occurrence count,
    i.e. without any file information or extra found text information.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

  <xsl:output method="text" indent="yes"/>
  <xsl:key name="hits-value" match="rslt:hit" use="substring(../rslt:text, @rslt:exprstart + 1, @rslt:exprlength)" />

  <xsl:template match="/">
    <xsl:apply-templates select="//rslt:hit"/>

  <xsl:template match="rslt:hit">
  	<xsl:if test="generate-id() = generate-id(key('hits-value', substring(../rslt:text, @rslt:exprstart + 1, @rslt:exprlength)))">      
    	<xsl:value-of select="substring(../rslt:text, @rslt:exprstart + 1, @rslt:exprlength)"/>
      <xsl:text> - </xsl:text>
    	<xsl:value-of select="count( key('hits-value', substring(../rslt:text, @rslt:exprstart + 1, @rslt:exprlength)) )"/>



by (31.4k points)