1

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.

1
  • I can substitute the spaces with tabs ` | perl -lpe "s/ +/\t/g; s/\s+$//" | cat -A` but if I have a void field I would join two columns with the substitution. Commented Mar 17, 2014 at 15:22

1 Answer 1

2

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$
1
  • Thanks I had the wrong impression that setting -separator I was setting implicitly -list mode. Commented Mar 21, 2014 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.