According to the official documentation this is how you can export a table to .csv:
sqlite> .header on
sqlite> .mode csv
sqlite> .once c:/work/dataout.csv
sqlite> SELECT * FROM tab1;
sqlite> .system c:/work/dataout.csv
However, on line 3 of this sequence of commands I get:
Error: unknown command or invalid arguments: "once". Enter ".help" for help
My path is valid, I have permission to write to that location. My sqlite3 version is
sqlite> .version
SQLite 3.8.2 2013-12-06 14:53:30 27392118af4c38c5203a04b8013e1afdb1cebd0d
running on Ubuntu 14.04
I have googled for this error message, nothing useful on it this far.
FIX:
sqlite> .header on
sqlite> .mode csv
sqlite> .output dataout.csv
sqlite> SELECT * FROM tab1
should work for the current version. Otherwise update to a newer version.