User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Find, replace, find in files, replace in files, regular expressions
3 posts Page 1 of 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.
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 Austria
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.
3 posts Page 1 of 1
cron