You can do something like this, for one record per file:

Sqlite3 db file.sqlite
while {[gets stdin line] > 0} {
    lappend content $line
}
set content [join $content "\n"; # or otherwise manipulate the text you got 
back.
db eval {INSERT INTO whatever (index, content) VALUES ($index, $content);}
db close

Or anything in between:

Sqlite3 db file.sqlite
while {[gets stdin line] > 0} {
    if {[matches_end_of_content $line]} {
       db eval {INSERT INTO whatever (index, content) VALUES ($index, 
$content);}
       set content {}
   } elseif {[matches_start_of_content $line]} {
      get_index_from_content $content index
   } else {
      add_line_to_content $line content
   } 
}
db close

On 2/1/18, 3:00 PM, "sqlite-users on behalf of Cecil Westerhof" 
<sqlite-users-boun...@mailinglists.sqlite.org on behalf of 
cldwester...@gmail.com> wrote:

    2018-02-01 21:49 GMT+01:00 Peter Da Silva <peter.dasi...@flightaware.com>:
    
    > It's pretty easy in Tcl
    >
    > Sqlite3 db file.sqlite
    > while {[gets stdin line] > 0} {
    >     parse_line_into index content; # or whatever you do to extract content
    > from the line
    >     db eval {INSERT INTO whatever (index, content) VALUES ($index,
    > $content);}
    > }
    > db close
    >
    
    ​Looks promising.​ The 'problem' is that I get a record pro line. But that
    is not a big problem I think. On the plus side it is easy to make a GUI
    instead of a command line version.
    
    Thanks.
    
    
    
    > On 2/1/18, 2:25 PM, "sqlite-users on behalf of Cecil Westerhof" <
    > sqlite-users-boun...@mailinglists.sqlite.org on behalf of
    > cldwester...@gmail.com> wrote:
    >
    >     At the moment I have a script where I send the output of a ffmpeg
    > command
    >     to the terminal and a file. Is it possible to send the output to a
    > SQLite
    >     table. I like to use tcl for this.
    >
    
    -- 
    Cecil Westerhof
    _______________________________________________
    sqlite-users mailing list
    sqlite-users@mailinglists.sqlite.org
    http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
    

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to