clarkseth
clarkseth

Reputation: 229

Remove Empty Lines From Powershell Output

i've a little problem in powershell with all my cmd output. I have to see on the screen a short cmd result. In the specific this is one of my problem:

cmd

PS C:\C_Directory> ls -Filter *.err|Measure-Object -Line| fw


1

 

As you can see, the Format Wide output it's with more empity lines. How can i transfor this output in :

1

Thanks in advance.

Upvotes: 4

Views: 6233

Answers (2)

E.V.I.L.
E.V.I.L.

Reputation: 2166

Jeff Hicks - a PowerShell MVP and more - has made a little filter to solve problems like this. It's called scrub. Hope that helps.

Upvotes: 4

Loïc MICHEL
Loïc MICHEL

Reputation: 26120

try this

 ls -Filter *.err|Measure-Object -Line | select -expand lines  

Upvotes: 5

Related Questions