Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gc c:FileWithEmptyLines.txt | where {$_ -ne ""} > c:FileWithNoEmptyLines.txt
- (gc file.txt) | ? {$_.trim() -ne "" } | set-content file.txt
- @(gc c:FileWithEmptyLines.txt) -match 'S' | out-file c:FileWithNoEmptyLines
- PS C:Users> (gc file.txt) | Foreach {$_.TrimEnd()} | where {$_ -ne ""} | Set-Content file.txt
- (Get-Content c:FileWithEmptyLines.txt) |
- Foreach { $_ -Replace "Old content", " New content" } |
- Set-Content c:FileWithEmptyLines.txt;
- [IO.File]::ReadAllText("FileWithEmptyLines.txt") -replace 's+rn+', "`r`n" | Out-File "c:FileWithNoEmptyLines.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement