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).Namewmd-Linux-22022.jsonwmd-Linux-22023.jsonwmd-Linux-22024.jsonwmd-Windows-22022.jsonwmd-Windows-22023.jsonwmd-Windows-22024.json
When I use select-string
, I get blank lines for some reason:
> (dir resources).Name | select-string Windowswmd-Windows-22022.jsonwmd-Windows-22023.jsonwmd-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?