Try using the "here document" syntax.

In <whatever>.sh

sqlite3 <<TheEnd
Update <table> set <field>='first line
second line
third line' where <condition>;
TheEnd

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Jacob Sylvia
Gesendet: Montag, 06. März 2017 13:25
An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Betreff: Re: [sqlite] Need some help running sqlite3 command line

I guess I should have mentioned that I'm trying to do this from a script, so 
that makes the command shell difficult.

~Jake
--
Jacob D. Sylvia
Jake Sylvia's Consulting
430 Cole St.
Seekonk, MA 02771
Cell: (508) - 954 - 2536
EMail: jacob.syl...@gmail.com
Web: http://www.jacobsylvia.com

On Mar 6, 2017 7:23 AM, "Hick Gunter" <h...@scigames.at> wrote:

> From sql shell (from a file works the same way):
>
> asql> create temp table test (a text); insert into test values('a
>    ...> b
>    ...> c
>    ...> d');
> rows inserted
> -------------
> 1
> asql> select * from test;
> a
> --------------
> a
> b
> c
> d
>
> -----Ursprüngliche Nachricht-----
> Von: sqlite-users
> [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von Jacob Sylvia
> Gesendet: Montag, 06. März 2017 13:02
> An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
> Betreff: Re: [sqlite] Need some help running sqlite3 command line
>
> Right...  I know the syntax. The problem lies in the 'value' part.
> Because the text has line breaks / carriage returns, I can't figure
> out how to do it appropriately from the command line.
>
> I've tried setting the value in a bash variable, but the breaks get
> interpreted and the syntax fails.
>
> ~Jake
> --
> Jacob D. Sylvia
> Jake Sylvia's Consulting
> 430 Cole St.
> Seekonk, MA 02771
> Cell: (508) - 954 - 2536
> EMail: jacob.syl...@gmail.com
> Web: http://www.jacobsylvia.com
>
> On Mar 6, 2017 6:28 AM, "Clemens Ladisch" <clem...@ladisch.de> wrote:
>
> > Jacob Sylvia wrote:
> > > Basically, I cant figure out how to update a text field in the
> > > sqlite config database from the command line...
> >
> > sqlite3 config.db "UPDATE SomeTable SET SomeColumn = 'value' WHERE
> > ID =
> 42"
> >
> > You need to know the database file name, the table name, the column
> > name(s), the new value(s), and how to identify the row(s) to update.
> >
> >
> > Regards,
> > Clemens
> > _______________________________________________
> > 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
>
>
> ___________________________________________
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: h...@scigames.at
>
> This communication (including any attachments) is intended for the use
> of the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you
> have received this communication in error, please immediately notify
> the sender by return e-mail message and delete all copies of the
> original communication. Thank you for your cooperation.
>
>
> _______________________________________________
> 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


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


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

Reply via email to