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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -