Using Find in Files to get distinct list of files based on content match

Using Find in Files to get distinct list of files based on content match

24
Basic UserBasic User
24

    Jan 09, 2017#1

    GOAL: Get a distinct list of file names using UEStudio (via the search function or any other function if search will not do this) based on a search of the files contents matching a specific string of text.

    SEARCH CRITERIA:
    SEARCH FILE TYPES: *.txt
    SEARCH LOCATION: \\MyServer\Files\
    SEARCH TEXT (Matching): Crystal

    I need to get a distinct list of file names (and nothing else) for all txt files in the specified location in which the file contains the text crystal. I can get UEStudio's SEARCH to do most of this but the results include more then the file name and that's all I want. If I try to extract the file names from what is returned in the Results window it will take as much time to remove the additional text in the search as it would be to manually go trough the files. The standard search returns the file name once for every single time the search text is found and it includes a bunch of date/time info making it difficult/tedious to get just a list of the matching file names themselves.

    6,602548
    Grand MasterGrand Master
    6,602548

      Jan 10, 2017#2

      First, the output format for the results of Find in Files can be configured at Advanced Settings/Configuration - Search - Set Find Output Format. But if you want the standard output format in general and just want the files names for this specific Find in Files, it is no good idea to change the configuration for output format.

      A simple solution would be the configuration of a user tool with the command line

      Code: Select all

      C:\Windows\System32\findstr.exe /I /M "Crystal" "\\MyServer\Files\*txt"
      and capture the output of this standard Windows console application (DOS program) to a file or the output window.

      Or the following macro is used in English UEStudio to run a Find in Files and reformat the output from standard format to a list of names of files with path only.

      Code: Select all

      InsertMode
      ColumnModeOff
      UltraEditReOn
      FindInFiles "\\MyServer\Files\" "*.txt" "Crystal"
      Find Up "Search complete, found"
      Key HOME
      SelectToBottom
      Delete
      Top
      Find MatchCase RegExp "%^{---^}^{F[io]u++nd^}*^p"
      Replace All ""
      Find MatchCase RegExp "%^(*^)([0-9]+):*$"
      Replace All "^1"
      SortAsc IgnoreCase RemoveDup RemDupByAllKeys RemKey1 1 -1 0 0 0 0 0 0
      
      For non English UE/UES the search string of Find Up and the second argument F[io]u++nd of OR expression must be adapted to localized output.
      Best regards from an UC/UE/UES for Windows user from Austria

      24
      Basic UserBasic User
      24

        Jan 23, 2017#3

        Mofi - I'll give this a try as soon as I can get my current interface/IDE issue with UEStudio resolved; I mentioned it in a separate post about how to reset the IDE/interface of UEStudio.