- description: Converts Comma-Separated-Values (CSV) data and similar data to SDDS. CSV
data is commonly used by spreadsheet programs.
- examples:
csv2sdds data.csv -columnData=name=x,type=float,units=m -columnData=name=Name,type=string data.sdds
- synopsis:
csv2sdds [CSVfile] [SDDSfile] [-pipe[=in][,out]]
[-asciiOutput] [-spanLines] [-maxRows=integer]
[-schFile=SCHfilename] [-skiplines=integer]
[-delimiters=start=character,end=character] [-separator=character]
[-columnData=name=string,type=string[,units=string] ...]
[-uselabels[=units]] [-majorOrder=<row|column>]
- files: CSVfile is a comma-separated-values file. Such a file consists of M rows each containing N
items of data, forming N columns. The items on each row are separated by commas (or by a
specified separator). The items may also be delimited by double quotation marks (or by specified
delimiters).
SDDSfile is the SDDS output that is created.
The optional SCHfilename is a way of specifying the column headers. The file is expected to contain
a series of lines of the form tag=valueList, where valueList is a comma-separated list of one or
more items. Lines not matching this format are ignored. The tag may be one of the
following:
- Filetype: optional. If given, must have valueList of Delimited.
- Delimiter: optional. If given, the first character of valueList is used for the start and
end delimiters.
- Separator: optional. If given, the first character of valueList is used for the separator.
- CharSet: optional. If given, must have valueList of ascii.
- FieldN, where N is an integer: one or more required. The integers N must be consecutive.
The first item in valueList is taken as the column name. The second item is interpreted
as the data type. At present, only the Float data type is actually interpreted as anything
other than character data. All others are treated as character string types. If needed,
sddsprocess may be used to process the resulting string columns to produce other data
types.
- switches:
- -pipe[=in][,out] — The standard SDDS Toolkit pipe option.
- -asciiOutput — Specifies ASCII output.
- -spanLines — Specifies that the program should ignore line breaks in parsing the input
data.
- -maxRows=integer — The maximum number of rows expected. This allows optimization
of the program, but isn’t essential.
- -schFile=filename — Specifies the name of a SCH file specifying the format of the
CSV file. I don’t know what SCH stands for, but apparently some PC programs generate
such files.
- -skiplines=integer — Skip the specified number of lines at the beginning of the input
file.
- -delimiters=start=character,end=character — Specifies start and end delimiters
for data. The default is to use a double-quotation mark for both.
- -separator=character — Specifies separator to use. The default is a comma.
- -columnData=name=string,type=string[,units=string] — Specifies the name and
data type of a column of data in the CSV file. One of these options should be given for
each column in the input file, in the same order as the columns appear in that file.
- -uselabels[=units] — The column names and optionally the units are defined in the
file prior to the data.
- -majorOrder=<row|column> — Writes output file in row or column major order.
- see also:
- author: M. Borland, ANL/APS.