Reputation: 2634
if I open the test.txt with notepad, it's a single line, no newlines between two "test". but if I open it with vim or ultraedit, I could see the newlines. what's the reason?
Set-Content .\test.txt "test`n`ntest"
update:
"test" | Out-File .\test.txt -Encoding ascii -Append
will append a newline that could be shown
Upvotes: 3
Views: 6175
Reputation: 6117
Simply use Windows line endings, rather than Unix ones:
Set-Content .\test.txt "test`r`ntest"
uses CRLF rather than your LFLF (CR = carriage return `r
, LF = linefeed `n
)
Notepad uses Windows line endings. Vim understands LF just fine.
Upvotes: 10
Reputation: 121699
If I'm understanding your question correctly, then you have a text file that has Unix newlines, instead of DOS carriage returns/line feeds.
Go into "hex edit" mode in UltraEdit and see if the end-of-line character is "0D0A" (carriage return/line feed), or just "0d" (newline).
Upvotes: 1