Re: [sqlite] How to import data from stdin?

2010-08-15 Thread Peng Yu
On Sun, Aug 15, 2010 at 5:58 PM, Simon Slavin wrote: > > On 15 Aug 2010, at 11:31pm, Peng Yu wrote: > >> $ cat file.txt >> 1     eenie >> 2     meenie >> 3     miny >> 4     mo >> $cat main.sql >> #!/usr/bin/env bash >> >> rm -f main.db >> sqlite3 main.db < file.txt < > That

Re: [sqlite] How to import data from stdin?

2010-08-15 Thread Simon Slavin
On 16 Aug 2010, at 12:40am, Peng Yu wrote: > This is called here document in bash. You can mix sqlite3 code with bash code. Thank you. I did not know about this function. I assume this page http://tldp.org/LDP/abs/html/here-docs.html describes what you're doing. > But my question on how to

Re: [sqlite] How to import data from stdin?

2010-08-15 Thread Sam Roberts
On Sun, Aug 15, 2010 at 4:40 PM, Peng Yu wrote: > On Sun, Aug 15, 2010 at 5:58 PM, Simon Slavin wrote: >> >> On 15 Aug 2010, at 11:31pm, Peng Yu wrote: >>> sqlite3 main.db < file.txt <> Some of those lines are commands to your Unix shell and others are

Re: [sqlite] How to import data from stdin?

2010-08-15 Thread Peng Yu
On Sun, Aug 15, 2010 at 5:58 PM, Simon Slavin wrote: > > On 15 Aug 2010, at 11:31pm, Peng Yu wrote: > >> $ cat file.txt >> 1     eenie >> 2     meenie >> 3     miny >> 4     mo >> $cat main.sql >> #!/usr/bin/env bash >> >> rm -f main.db >> sqlite3 main.db < file.txt < > That

Re: [sqlite] How to import data from stdin?

2010-08-15 Thread Simon Slavin
On 15 Aug 2010, at 11:31pm, Peng Yu wrote: > $ cat file.txt > 1 eenie > 2 meenie > 3 miny > 4 mo > $cat main.sql > #!/usr/bin/env bash > > rm -f main.db > sqlite3 main.db < file.txt < create table test (id integer primary key, value text); > .separator "\t" > .import /dev/stdin

[sqlite] How to import data from stdin?

2010-08-15 Thread Peng Yu
Hi, I have the following data file and sql script. But I get the following error. I think that I should be able to import the data from from /dev/stdin. I replace /dev/stdin with an ordinary file and it works. Could anybody let me know what is the correct way to do so? Thank you very much!