As the title says it, Notepad doesn't show line breaks, specifically \n. But in Windows Explorer, in the preview window, it does show line breaks that are just \n (really Microsoft?). After doing some experimentation, it turns out notepad actually puts a \r\n for line breaks. This is annoying because the Mac TextEdit application just puts \n and as a user who uses both Mac and Windows simultaneously for programming purposes, this is very annoying. Is there anyway to make Notepad recognize just \n as a line break? I'm not sure why it doesn't because that's just an extra byte per line and in a CSV file that can really add up.
Asked
Active
Viewed 1.6k times
2
2 Answers
4
Yes, Microsoft uses carriage return and line feed (both characters) for end of line but only one on Mac. In development, I use Adobe Dreamweaver which you can set to solve that. I develop on both Mac and Win platforms. I am unaware of making notepad do that however. You can try Wordpad, it handles it better than notepad though.
Jeff Clayton
- 1,138
3
Mac is a Unix like operating system. Unix like operating systems do not use carriage return in outputting line breaks. So if you want your file show line breaks when opening it with notepad, you must first convert the file to a dos file.
So in Mac replace every occurrence of \n by \r\n
perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile
segfault
- 81