Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Empty Lines From Powershell Output

Tags:

powershell

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.

like image 932
clarkseth Avatar asked Jan 11 '23 07:01

clarkseth


2 Answers

try this

 ls -Filter *.err|Measure-Object -Line | select -expand lines  
like image 137
Loïc MICHEL Avatar answered Jan 19 '23 04:01

Loïc MICHEL


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

like image 21
E.V.I.L. Avatar answered Jan 19 '23 04:01

E.V.I.L.