Here is a minimal repro example.
Expected result:
PS C:\> ("a", "b")
a
b
PS C:\> ("a", "b") | Select-String "b"
b
PS C:\>
Actual result:
PS C:\> ("a", "b")
a
b
PS C:\> ("a", "b") | Select-String "b"
b
PS C:\>
As you can see, the second output has one empty line before and two empty lines after the matched lines.
Why does that happen? And what can I do about it?
(Note: This is a minimal example. In my real code, I'm parsing svn status output for uncommitted files and I get the same problem of spurious newlines.)
| Select-Object -ExpandProperty Lineto get rid of the newlines but I have no idea why it adds the newlines so I'll wait for someone else to answer...Select-Stringdoes a implicit version ofFormat-*? :OOut-Defaulthave implicit version ofFormat-*.