I currently have the following
Get-ChildItem -recurse -include file.ext | Select-String -pattern "c:" | group path | select name | export-csv results.csv
If I wanted to find things with both "c:" and "d:" how would I write that logic?
Thanks
I currently have the following
Get-ChildItem -recurse -include file.ext | Select-String -pattern "c:" | group path | select name | export-csv results.csv
If I wanted to find things with both "c:" and "d:" how would I write that logic?
Thanks
Select-String
takes a regex, so you can just use
Select-String '[cd]:'
which will match either c:
or d:
.
For more complex ones you can use an alternation construct:
Select-String '(mike|sally):'
|
. If you want special characters in regex to still perform their special-ness you must not escape them.
group
andselect
part by usingselect -unique path
. Although your column name in the CSV would change, then.