I have a plain text file of tab-separated values that was created on a Windows machine. I want to import it into Mathematica on a Mac.
rawdata = Import["filename.csv", "tsv"]
The output list has a blank list every other element. I think this is due to the old
\n compatibility issue. How can I tell
Import which convention the input file is using?
Edit: I should mention that I want to do this in a cross-platform way, because I'll probably be moving notebooks between Mac and Windows machines. So simply skipping every other element of the output list (
[[1;2;-1]]) won't work.
Edit 2: This is what the file looks like when I open it in Emacs:
... 4.510000000000000E+008 -1.052316667849458E+002 -1.412043034275902E+002 ^M 4.515000000000000E+008 -1.159523802353636E+002 1.631532615796773E+002 ^M ...
The spaces between the fields are tabs. A moment's Googling tells me that
^M is a carriage return (
\r). This fits my hypothesis that the Windows-based device is terminating lines with
\r\n, and Mathematica is reading that as two new-lines. My question remains: How do I tell
Import what EOL characters are in use in my file?