I'm having a problem importing tab-separated files containing quotes. For example:
When I take a tab-separated text file (quote_test.txt), containing these lines... Unquoted value 1 Unquoted value 2 "Quoted" value 1 "Quoted" value 2 ... and try to import it in SQLite with these commands: create table quote_test (value1, value2); .separator \t .import quote_test.txt quote_test I get this error: quote_test.txt line 2: expected 2 columns of data but found 1 I know I can work around this by either replacing the double quotes with single quotes... Unquoted value 1 Unquoted value 2 'Quoted' value 1 'Quoted' value 2 ... or by enclosing the entire field by quotes: Unquoted value 1 Unquoted value 2 ""Quoted" value 1" ""Quoted" value 2" The problem is: for a project I'm currently working on, I need to import very large files (containing millions of lines) that also have the issue I'm describing here. So I have two questions: 1. Is there a way I can workaround the SQLite limitation? The data works fine with e.g. Oracle's SQL*Loader. For performance reasons, I would prefer to "feed" SQLite the data without modification. 2. If there is no way to make SQLite work with this, can anyone suggest me a fast sed command I can use to *enclose* the fields containing quotes with quotes. It doesn't seem very trivial. Replacing it with single quotes is easy (sed "s/\"/'/g"), but I would prefer to load the data as delivered. Thanks in advance, - Danny _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users