sqlite3 command line - how to set mode and import in one step
5
votes
1
answer
3191
views
I need to be able to do this via command line in one step:
lab-1:/etc/scripts# sqlite3 test.db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> .mode csv ;
sqlite> .import /tmp/test.csv users
sqlite> select * from users;
John,Doe,au,0,"",1,5555,91647fs59222,audio
sqlite> .quit
I've tried the following:
lab-1:/etc/scripts# sqlite3 test.db ".mode csv ; .import /tmp/deleteme.csv users"
and
lab-1:/etc/scripts# sqlite3 test.db ".mode csv .import /tmp/deleteme.csv users"
I don't get errors but I also don't end up with any data in the users table.
Any tips would be appreciated.
Asked by dot
(755 rep)
May 23, 2018, 06:46 PM
Last activity: Jun 12, 2025, 08:19 PM
Last activity: Jun 12, 2025, 08:19 PM