I want to use select-string
on the output of another command (similar to how one would use grep
on a Unix OS).
Here is the output of the command without the select-string
:
> (dir resources).Name
wmd-Linux-22022.json
wmd-Linux-22023.json
wmd-Linux-22024.json
wmd-Windows-22022.json
wmd-Windows-22023.json
wmd-Windows-22024.json
When I use select-string
, I get blank lines for some reason:
> (dir resources).Name | select-string Windows
wmd-Windows-22022.json
wmd-Windows-22023.json
wmd-Windows-22024.json
How can I either (A) tell select-string to eat the blank lines with no matches, or (B) pipe the output to another powershell utility that could eat the blank lines for me?
(dir resources\*windows*).name