sql is a command line tool for a formated output of mSQL tables. A lot of options can specify the desired output format. It even has the capability to write mSQL tables in HTML format or to use it as a simple Perl interface.
echo "select * from Filmlex" | sql Filmlexikon
a simple Query 12-monke::12 Monkeys:USA:1995:x:x 2-girls::Two Girls In Love:USA:1995:x: 2-leben:Die:zwei Leben der Veronika:P/F/D:1991:x: drei-bla::Drei Farben Blau:P/F:1993:x: 4-rooms::Four Rooms:USA:1995:x: 7-footpr::Seven Footprints to Satan:USA:1929:x:echo "select * from Filmlex" | sql -s "\t" Filmlexikon
use tabulators as seperator 12-monke 12 Monkeys USA 1995 x x 2-girls Two Girls In Love USA 1995 x 2-leben Die zwei Leben der Veronika P/F/D 1991 x drei-bla Drei Farben Blau P/F 1993 x 4-rooms Four Rooms USA 1995 x 7-footpr Seven Footprints to Satan USA 1929 xecho "select * from Filmlex" | sql -b "<TR><TD>" -s "</TD><TD>" -e "</TD></TR>\n" Filmlexikon
a HTML table, I added the <TABLE BORDER> and the </TABLE> tag to the beginning and the and of the HTML table
12-monke | 12 Monkeys | USA | 1995 | x | x | |
2-girls | Two Girls In Love | USA | 1995 | x | ||
2-leben | Die | zwei Leben der Veronika | P/F/D | 1991 | x | |
drei-bla | Drei Farben Blau | P/F | 1993 | x | ||
4-rooms | Four Rooms | USA | 1995 | x | ||
7-footpr | Seven Footprints to Satan | USA | 1929 | x |
echo "select * from Filmlex" | sql -q Filmlexikon
the q-option >query select * from Filmlex >result 12-monke::12 Monkeys:USA:1995:x:x 2-girls::Two Girls In Love:USA:1995:x: 2-leben:Die:zwei Leben der Veronika:P/F/D:1991:x: drei-bla::Drei Farben Blau:P/F:1993:x: 4-rooms::Four Rooms:USA:1995:x: 7-footpr::Seven Footprints to Satan:USA:1929:x:echo "select * from Filmlex" | sql -fiknult -b "|" -s "|" -e "|" Filmlexikon
turn everything on ----------------------------------------------------------------------------------------- |-5 |Datei |Artikel|Film |Land |Jahr |Kurz |Kritik| |-4 |8 |4 |30 |16 |4 |1 |1 | |-3 |CHAR |CHAR |CHAR |CHAR |CHAR |CHAR |CHAR | |-2 |PN | | N | | | | | ----------------------------------------------------------------------------------------- |0 |12-monke| |12 Monkeys |USA |1995 |x |x | |1 |2-girls | |Two Girls In Love |USA |1995 |x | | |2 |2-leben |Die |zwei Leben der Veronika |P/F/D |1991 |x | | |3 |drei-bla| |Drei Farben Blau |P/F |1993 |x | | |4 |4-rooms | |Four Rooms |USA |1995 |x | | |5 |7-footpr| |Seven Footprints to Satan |USA |1929 |x | | -----------------------------------------------------------------------------------------Use sql with Perl
sql as a sipmle interface to Perl open(SQL, "echo \"SELECT * FROM Filmlex\" | sql Filmlexikon |"); $i = 0; while(<SQL>) { m/(.*):(.*):(.*):(.*):(.*):(.*):(.*)\n/; $film[$i] = $2 . " " . $3; $land[$i] = $4; $jahr[$i] = $5; $kritik[$i] = $7; $i++; } close(SQL);
This software may be freely copied, modified, and redistributed, provided that this copyright notice is preserved on all copies. There is no warranty or other guarantee of fitness for this software, it is provided solely "as is". Bug reports or fixes may be sent to the author, who may or may not act on them as he desires. You may not include this software in a program or other software product without supplying the source, or without informing the end-user that the source is available for no extra charge. If you modify this software, you should include a notice giving the name of the person performing the modification, the date of modification, and the reason for such modification.