Timport can import data in the common "comma separated values" format.
To use this format specify the format keyword with a value of
csv, optionally followed by the delimiter to use instead of comma.
The delimiter may be specified using hex notation for space, tab, or other
special characters. Encode hex values with backslash followed by "x"
followed by the 2 digit hex value. For example, encode tab as "\x09
"
(without the quotes).
For the field "tag"s use the field number from the input. Input fields are numbered starting with 1.
The following example consists of customer data exported from another program in csv format, but with | for a delimiter instead of comma.
"CustID"|"Company"|"Address"|"City"|"Region"|"PostalCode"|"Country"|
"Phone"
"ALWAO"|"Always Open Quick Mart"|"77 Overpass Ave."|"Provo"|"UT"|
"84604"|"USA"|"(801) 555-7424"
"ANDRC"|"Andre's Continental Food Market"|"P.O. Box 209"|"Bellingham"|
"WA"|"98226"|"USA"|"(206) 555-9574"
"ANTHB"|"Anthony's Beer and Ale"|"33 Neptune Circle"|"Clifton Forge"|
"WA"|"24422"|"USA"|"(509) 555-8647"
"BABUJ"|"Babu Ji's Exports"|"Box 29938"|"London"||"WX1 5LT"|"UK"|
"(71) 555-8248"
The schema format for this is as listed in the schema file
csv.sch
:
database /tmp/testtdb
table customer
csv |
# name type tag
field CustID varchar(10) 1
field Company varchar(80) 2
field Address varchar(80) 3
field City varchar(20) 4
field State varchar(10) 5
field Zip varchar(10) 6
field Country varchar(10) 7
field Phone varchar(20) 8