windows - UNIX format files with Powershell -
how create unix file format in powershell? using following create file, creates in windows format.
"hello world" | out-file -filepath test.txt -append
as understand, new line characters crlf make windows format file whereas unix format needs lf @ end of line. tried replacing crlf following, didn't work
"hello world" | %{ $_.replace("`r`n","`n") } | out-file -filepath test.txt -append
one ugly-looking answer (taking input dos.txt outputting unix.txt):
[string]::join( "`n", (gc dos.txt)) | sc unix.txt
but able make set-content , solution not stream , therefore not work on large files...
and solution end file dos line ending well... not 100%
Comments
Post a Comment