Delimiter Separated Fields
When processing delimiter-separated text, each field in the input line is separated by the delimiter specified by the Column Separator field. Leading and trailing spaces are stripped from each field and the specified Line Separator determines when a new record starts. Data Format illustrates an series of input lines containing comma-separated fields, each record on one line.
In some situations, you may not be able to choose a column separator character that does not appear in any column data. For example, if you choose a comma as the column separator, there may be commas in some of the column values. To process data that contains column separator characters in a column, you can surround the column with double quotes (" "
). Double quotes also allow you to include leading and trailing spaces as well as line breaks in a field. If you want to have a double quote appear in a field, escape the double quote by using two consecutive double quotes. That is, use ""
to represent a double quote in a field.
The following data illustrates input lines with each field separated by commas. Some fields, however, contain commas, leading or trailing spaces, double quotes, and line breaks.
57643, Smith, "Chris", Accounting , "Statement: Be prepared!"
57644, Jones, "Pat ", Marketing , "Statement: To paraphrase JFK, ""Ask not what your company can do for you,
ask what you can do for your company."""
57645, Walker, "Terry", Develpment , "Statement: My goal is to be CEO someday."
Notice that Pat Jones’ statement spans two lines and contains double quotes as well as a comma. The entire field is surrounded by double quotes, so it is still treated as part of the same record.