tags:

views:

148

answers:

2

I have started to use (or, try to use) sqlite for a simple catalog. What I want to do is be able to take out the information for each catalogued item from the sqlite, and export it into a text file. e.g.

Title1, Genre1, Author1

Title2, Genre2, Author2

Title3, Genre3, Author3

I don't want these to be in columns, just a single line. Also, is there a way to use multiple different separators?

This seems like it should be relatively easy to do, but I am totally new to this and can't figure it out.

+1  A: 

sqlite -list -separator ', ' db.db 'select * from thetable'

should do.

Michael Krelin - hacker
A: 

Like @hacker said, you can use sqlite -list when you need to specify the delimiter character. You can also use simple output such as sqlite -csv if you don't need to be terribly specific.

You probably want to refer to the SQLite command line documentation for more information about generating textual output from an interactive SQLite command, or you could man sqlite too, although it's similar information.

Mark Rushakoff