Late follow up: > .import "tail -n +2 foo.csv |" mytable
Found out today that this works (Though the pipe character has to be the first character, not the last) and apparently has for years, though I can't find it documented anywhere. On Thu, Mar 21, 2019 at 4:06 PM Shawn Wagner <shawnw.mob...@gmail.com> wrote: > Importing a CSV file in the command line shell has two different > behaviors: if the table to import to doesn't exist, treat the first row of > the file as a header with column names to use when creating the table. If > the table does exist, treat all rows as data. > > A way to skip a header row when the table exists would be useful. > Sometimes it's awkward to make a copy of a file minus the first line before > doing the import. > > Alternatively, allow .import to pipe from the output of a command, not > just a file: > > .import "tail -n +2 foo.csv |" mytable > > More work to implement, but a lot more flexible, and it would match the > behavior of .output and .once. If the devs are willing to accept user > contributed patches to the shell, I'd happy to look into implementing that. > > Also something I've run into that would be useful: a way to strip leading > and trailing whitespace from unquoted fields before inserting them. > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users