powershell: how to out-file to unix line ending

how to get a output to have unix styled newline?

I wanted to do something like this:

get-content $inputFile | select-string 'something' | ... | out-file -Encoding utf8 -width 999000 log_report.txt

I'm hoping that out-file has a option something like “-newline unix”, but doesn't.

I tried this:

get-content testFile.txt | &{$input -replace "'r'n","'n" } > testFile2.txt

but that doesn't work. Apparently, the > operator again made it DOS line endings.

am unix sys admin & programer for years. New to Windows. Thanks.

∑ http://xahlee.org/

No comments:

Post a Comment