The Linux Page

CSV format

A quick CSV (Comma Separated Values) reference:

Row separator

  \n   \r\n

In order to separate lines, use a newline character sequence.

Most loaders probably support the \r sequence too. (Especially on MacOS/X)

Value separator

  ,  |  <tab> (\t)

As the name states, values are separated by commas. This is the default although most loaders support other characters. Commonly used characters are pipes and tabs.

Quoting

  "   ""
Separator

Values that include a separator need to be quoted. For this, the double quote is used (i.e. similar to a C string).

Double Quotes

When the value includes a double quote, then two double quotes are used. This the value

This "word" is too long

becomes

"This ""word"" is too long"

Spaces

Quoting should be used if the value starts and ends with spaces so they do not get trimmed. Many tools will trim the spaces even though it is not formal.

New-line

Quoted values can include a new-line character

"This sentence
wraps"

Example

  Cars,Color
  Chevrolet,White
  Ford,Green
  Nissan,Purple
  Peugeot,Yellow
  Mercedes,"Blue Green"
  "Rolls Royce",Pink
  Ferarri,Red
  """Other""",Unknown