Answer the question
In order to leave comments, you need to log in
How can blob response from sqlite3 be saved into a variable in Bash?
In bash script for query in sqlite3
SELECT values FROM tables WHERE keyname='namefirst';
7B 00 22 00 6E 00 61 00 6D 00 65 00 22 00 3A 00 22 00 6A 00 6F 00 68 00 6E 00 22 00 7D, which corresponds
{�"�n�a�m�e�"�:�"�j�o�h�n�"�}
{"name":"john"}.
Answer the question
In order to leave comments, you need to log in
You can't process the string because your base is most likely in utf-8 (check, type ".show"), and the value is stored in utf-16. It's hard to do this on a clean base.
As a shortcut, output (.mode quote) and then convert via xxd
sqlite3 -quote $fileIn "SELECT values FROM tables WHERE keyname='namefirst'" | xxd -r -p > $fileOut
I would think about properly setting encodings, collate or something. Because it can be trite double-byte unicode.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question