Re: [sqlite] Tee to a table
Switch -glob and switch -regexp are also handy for this kind of code. On 2/1/18, 3:07 PM, "sqlite-users on behalf of Peter Da Silva"wrote: 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" wrote: 2018-02-01 21:49 GMT+01:00 Peter Da Silva : > 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 ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Tee to a table
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"wrote: 2018-02-01 21:49 GMT+01:00 Peter Da Silva : > 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
Re: [sqlite] Tee to a table
2018-02-01 21:49 GMT+01:00 Peter Da Silva: > 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
Re: [sqlite] Tee to a table
On 1 Feb 2018, at 8:55pm, Cecil Westerhofwrote: >> Can you use scripting commands to include it in a file which scripts the >> SQLite command-line tool ? > > I am not sure what you mean. You can ignore my suggestion. You are using Tcl and it's easier in Tcl. Sorry, I did not notice that part of your text. Simon. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Tee to a table
2018-02-01 21:42 GMT+01:00 Simon Slavin: > On 1 Feb 2018, at 8:25pm, Cecil Westerhof 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. > > Is the output a string of text ? > Text. It start for example with: 07:00:25: converting MVI_6580.MOV ffmpeg version 3.2.8-1~deb9u1 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat57. 56.101 / 57. 56.101 libavdevice57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc54. 1.100 / 54. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_6580.MOV': Can you use scripting commands to include it in a file which scripts the > SQLite command-line tool ? > I am not sure what you mean. -- Cecil Westerhof ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Tee to a table
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 On 2/1/18, 2:25 PM, "sqlite-users on behalf of Cecil Westerhof"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
Re: [sqlite] Tee to a table
On 1 Feb 2018, at 8:25pm, Cecil Westerhofwrote: > 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. Is the output a string of text ? Can you use scripting commands to include it in a file which scripts the SQLite command-line tool ? Simon. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users