title: Merge multiple SQLite databases using bash?
body: <p>I have multiple sqlite databases with the same schema, and i want to merge them all together, since i have a unique column and there might be risks of duplicates, i am using <code>insert or ignore</code>, in sqlite it would be easy :</p>
  
  <pre><code>sqlite3 database.db3
  sqlite&gt; attach './db1.db3' as s1;
  sqlite&gt; attach './db2.db3' as s2;
  sqlite&gt; attach './db3.db3' as s3;
  sqlite&gt; insert or ignore into table (c1, c2, c3) select c1, c2, c3 from s1.table;
  sqlite&gt; insert or ignore into table (c1, c2, c3) select c1, c2, c3 from s2.table;
  sqlite&gt; insert or ignore into table (c1, c2, c3) select c1, c2, c3 from s3.table;
  sqlite&gt; .exit
  </code></pre>
  
  <p>I read about dump but i dont want to merge the whole schema, just one table, so i thought about this solution, now till here everything is fine but i need to run all this via a bash,  i tried the following but it doesnt :</p>
  
  <pre><code>sqlite3 database.db3 "attach './db1.db3' as s1;"
  sqlite3 database.db3 "attach './db2.db3' as s2;"
  sqlite3 database.db3 "attach './db3.db3' as s3;"
  sqlite3 database.db3 "select count(*) from s1.table;"
  sqlite3 database.db3 "select count(*) from s2.table;"
  sqlite3 database.db3 "select count(*) from s3.table;"
  </code></pre>
  
  <p>it says <code>Error: no such table: s1.table</code></p>
  
  <p>What am i doing wrong</p>