I'm pretty sure Powershell's select-string will work for me with a bit of Get-ChildItem recursion.
I have many directories like this:
abc_123
abc_345
abc_567
abc_890
abc_111
abc_569
In each directory, there's a specific file with the same path to each file in each directory:
abc_123:\AAA\SDK\Settings\foo.settings.xml
abc_345:\AAA\SDK\Settings\foo.settings.xml
abc_567:\AAA\SDK\Settings\foo.settings.xml
And so on.
Within the foo.settings.xml file, I want to search for "BAR." and also one line below it:
<name="BAR.ABB"
default="1"
Problem that I'm having is within the directory that has abc_123,abc_345,abc_567, etc, there's other directories that also contain BAR.*. I don't care about those results.
I'm attempting something like this but it's not working.
Get-ChildItem -Recurse *.* | Select-String -Pattern "BAR.*" foo.settings.xml | Select-Object -Unique Path
Where in my command can I specify I only want to search directories beginning with abc_ and at that specific path?
--- edit ---
The path always begins abc_* and foo.settings.xml always has this path:
abc_*:\AAA\SDK\Settings\foo.settings.xml
I tried this:
Get-ChildItem -Recurse | Where-Object {"abc_*"} | Select-String –Pattern "BAR.*", but this seems to give the same results from above.