I also discovered that I can just use the "-header" and "-column"
qualifiers before specifying the DB name.  And, apparently, you can even
epscify the init file with "-init".(foolish me, I was looking for this
type of info before using "-h".. not "-help").

-dave
 

-----Original Message-----
From: Joe Wilson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 22, 2007 2:48 PM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] executing sql on a sqlite from the cmd line

--- "Gauthier, Dave" <[EMAIL PROTECTED]> wrote:
> But how can I ".mode column" and  ".header on" as well as run the
query

If you're using bash (ksh and sh might work as well):

$ echo -e ".header on\n.mode column\nselect * from sqlite_master;" |
./sqlite3 abc.db
type        name        tbl_name    rootpage    sql
----------  ----------  ----------  ----------  -----------------------
table       abc         abc         2           CREATE TABLE abc(a,b,c)
table       xyz         xyz         3           CREATE TABLE xyz(x,y,z)

or if you have printf(1):

$ printf ".header on\nselect * from sqlite_master;" | ./sqlite3 abc.db
type|name|tbl_name|rootpage|sql
table|abc|abc|2|CREATE TABLE abc(a,b,c)
table|xyz|xyz|3|CREATE TABLE xyz(x,y,z)

See also: http://www.sqlite.org/cvstrac/wiki?p=ShellScript



       
________________________________________________________________________
____________
Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+ki
ds&cs=bz 

------------------------------------------------------------------------
-----
To unsubscribe, send email to [EMAIL PROTECTED]
------------------------------------------------------------------------
-----

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to