Pregunta

I have a .sqliterc file with .mode column.

Now despite I run

sqlite3 -separator $'\t' .....

It is padded with spaces instead tabs:

sqlite3 -separator $'\t' ..... | cat -A

 -- Loading resources from /home/xyz/.sqliterc
 Ensembl_Gene_ID     gene      $
 ------------------  ----------$
 ENSMUSG00000038503  Mesdc2    $
 ENSMUSG00000038503  Mesdc2    $
 ENSMUSG00000038503  Mesdc2    $
 ENSMUSG00000038503  Mesdc2    $

How can override some of the options in .sqlitrc. If it is possible I would rather don't switch off .sqliterc but overwrite some options.

¿Fue útil?

Solución

The -separator $'\t' option does not take effect because in column output mode, each record is shown on a separate line with the data aligned in columns.

The sqlite3 command line option does overwrite the settings in .sqliterc. Try overwriting the output mode using -list option, then you will see -separator $'\t' takes effect.

sqlite3 -separator $'\t' -list  -header  test.db "select * from test" | cat -A

The output is in list mode, \t as the separator:

-- Loading resources from /home/test/.sqliterc
Ensembl_Gene_ID^Igene$
ENSMUSG00000038503^IMesdc2$
ENSMUSG00000038503^IMesdc2$
ENSMUSG00000038503^IMesdc2$
ENSMUSG00000038503^IMesdc2$
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top