SQLite: -tabs option is missing
(1) By anonymous on 2020-10-31 15:51:02 [link]
SQLite has a built-in 'tabs' mode. But it is not exposed as a command line option. sqlite3.exe version 3.33.0 has options for all the other modes: `-box`, `-html`, `-markdown`, etc. But not `-tabs`. And this causes various workarounds because providing a TAB character on the command line is not so straightforward. 1. `sqlite3 mydb "select * from table1" | tr \| '\t'` 2. `sqlite3 -separator $'\t' mydb "select * from table1"` ($ tells shell to expand \\t to a TAB character) 3. ``` sqlite3 mydb <<EOF .mode tabs select * from table1; EOF ``` Neither of these solutions work on Windows. It should be very easy to implement the `-tabs` option. And I believe it will make life easier for many people.
(2) By Donald Griggs (dfgriggs) on 2020-10-31 16:12:20 in reply to 1 [link]
Not speaking to the merits of your suggestion directly, but wanted to be sure you're aware that the commandline interface program does easily let you pick a separator for input or output. <code> .separator \\t </code>
(3) By anonymous on 2020-10-31 16:33:23 in reply to 2 [link]
When I do `-separator \t` on Windows I get a literal '\\t' string as a separator. I suppose it is the same on Linux. That is why solution #2 above has extra '$'. And just in case, I did not mean interactive session. There I could activate `.mode tabs` directly. This is about "one-off" commands with the query on the command line.
(4.1) By TripeHound on 2020-10-31 22:15:42 edited from 4.0 in reply to 3
Either: ``` sqlite3 V1LS.sql3db -cmd ".mode tab" "select * from members" ``` or: ``` echo select * from members | sqlite3 V1LS.sql3db -cmd ".mode tab" ``` seems to work OK in Windows.
(5) By anonymous on 2020-10-31 19:03:36 in reply to 4.0 [link]
Thank you! I overlooked that `-cmd` option. That would be workaround #4. I still think there should be `-tabs` option too though.
(6) By anonymous on 2020-10-31 19:05:34 in reply to 4.0 [link]
Correction: the mode is called 'tabs' not 'tab'.
(7) By Larry Brasfield (LarryBrasfield) on 2020-10-31 19:25:47 in reply to 6 [link]
Both <code> .mode tab </code>and <code> .mode tabs </code>have the same effect, leaving the tab character as the list mode column separator.