- description: Converts Comma-Separated-Values (CSV) data and similar data to SDDS. CSV data
is commonly used by spreadsheet programs.
- example:
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]
[-delimiters=start=character,end=character]
[-separator=character]
-schFile=SCHfilename | [-columnData=name=string,type=string[,units=string] ...]
- 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.
- -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.
- -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.
- -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.
- -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.
- see also:
- author: M. Borland, ANL/APS.