I want my program to always save a text file with unix-style LF line breaks (even when Mathematica runs on Windows). But the way the built-in Export command works depends on the operating system.
For example the following code:
testFile = "newlinetest.txt";
testStringList = {"abc", "abc"};
Export[testFile, testStringList, "List"];
BinaryReadList[testFile]
Linux or Mac OS gives exactly what I want:
{97, 98, 99, 10, 97, 98, 99}
Windows adds an extra CR symbol:
{97, 98, 99, 13, 10, 97, 98, 99}
Is there a normal way to save text files with unix-style newline on Windows?
{97, 98, 99, 13, 10, 97, 98, 99}from v7 under Windows. – Mr.Wizard Jan 24 '13 at 16:22{97, 98, 99, 10, 97, 98, 99}from v9, so I guess they fixed something. – librik Jan 24 '13 at 20:43{97, 98, 99, 13, 10, 97, 98, 99}from v8 under Windows XP. – Nick Stranniy Jan 24 '13 at 21:57