Sometimes you need find substring or group of strings into text files in folder. For resolve this task I use Powershell script. It displays the number of occurrences of the string and file names where the substring is found.
$subStrings = @("Substing1", "Substing2", "Substing3"); # your substrings $Path = "C:\"; # folder with files $result = ""; foreach ($element in $subStrings) { $i=0; $fileName = ""; # This code snippet gets all the files in $Path that end in ".txt". Get-ChildItem $Path -Filter "*.txt" -Recurse | Where-Object { $_.Attributes -ne "Directory"} | ForEach-Object { If (Get-Content $_.FullName | Select-String -Pattern $element) { $i++; $fileName += $_.FullName + "r
n"; } } $result += "Quantity of " + $element + " = " + $i + "r
n"; $result += $fileName + "r
n"; } $result > "C:\result.txt" #output file with search result
You can to extension. Change line number 12 -Filter parameter («*.txt»).
into files with any