How does libreoffice express a linebreak when saving a csv?

Posted on

Problem :

I’m attempting to save a CSV using LibreOffice Calc to be imported to a MySQL database. Saving it as a CSV is pretty straightforward in LibreOffice but I don’t know how the resulting document expresses linebreaks?

My guess is that—since I’m using Ubuntu—it uses the standard Linux notation but I can’t figure out how to confirm that. Whenever I open the CSV in a text editor or use cat in the Terminal, it just shows an actual line break.

How can I confirm/check the notation being used?

Solution :

Use the file utility like so: file <filename>

For files with *NIX line endings you should see “ASCII text”.

For files with Windows line endings you should see “ASCII text, with CRLF line terminators”.

You can of course use dos2unix and unix2dos to convert between the two.

You can use a hex editor and open the exported file, and see for yourself.

Leave a Reply

Your email address will not be published.