In PowerShell I have tried:
alias | select-string Alias
This fails even though Alias
is clearly in the output. I know this is because select-string is operating on some object and not the actual output string.
What can be done about it?
There are two problems. As in the question, select-string needs to operate on the output string, which can be had from "out-string". Also, select-string doesn't operate linewise on strings that are piped to it. Here is a generic solution
(alias|out-string) -split "`n" | select-string Write