how to convert a file from DOS to Unix

dos2unix, powershell

Solution

It could be as simple as

Get-Content in.csv -raw | % {$_ -replace "`r", ""} | Set-Content -NoNewline out.csv

Above method will work on powershell version 3+. If you are below that you can use below method instead. Almost same as one of the other answers here.

$csvdata = [io.file]::ReadAllText('in.csv') | % {$_ -replace "`r",""}
[io.file]::WriteAllLines('out.csv', $csvdata)

Problem

I need to convert a file from DOS to Unix in PowerShell. I know this can be very much easily done in Unix: ``` dos2unix file newfile ```

Original source

Related problems