Toret
Toret

Reputation: 75

import on csv to sqlite3 crashes

I have a csv file that is comma delimited. I have no problem with the importing aspect of it except for when the import reaches a line like this:

1,2,3, Canada's,5, 6,7

The import crashes when it reaches the single quote. Does anyone know of a program I could use to import my csv file in to sqlite database without having to get rid of all my single quotes?

Upvotes: 0

Views: 538

Answers (1)

godswearhats
godswearhats

Reputation: 2255

Try this on the command line (i.e. in Terminal):

cat filename.csv | sed "s/'/\\\\'/g" > new_filename.csv

That will create a new file with all the single quotes escaped with a backslash, which should allow you to import it. Of course, it depends on whether your importer recognizes backslashes, but it's worth a try :-)

Upvotes: 1

Related Questions