更新时间:2023-02-09 13:35:00
I found a nice one liner here >> http://www.pixelchef.net/remove-empty-lines-file-powershell. Just tested it out with several blanks lines including newlines only as well as lines with just spaces, just tabs, and combinations.
(gc file.txt) | ? {$_.trim() -ne "" } | set-content file.txt
有关该代码的一些注释,请参见原始文档.不错:)
See the original for some notes about the code. Nice :)