You can simply specify the database file name in the command line:
bash-3.2 # sqlite3 UserDb.sqlite
SQLite version 3.16.2 2017-01-06 16:32:41
Enter ".help" for usage hints.
sqlite> .databases
main: /db/UserDb.sqlite
sqlite> .tables
accountLevelSettings genres syncedThumbs
collectionActivity recordingFilter thumbs
contentStatus syncedContentStatus
sqlite> select count(*) from genres;
10
Moreover, you can execute your query from the command line:
bash-3.2 # sqlite3 UserDb.sqlite 'select count(*) from genres'
10
You could attach another database file from the SQLite shell:
sqlite> attach database 'RelDb.sqlite' as RelDb;
sqlite> .databases
main: /db/UserDb.sqlite
RelDb: /db/RelDb_1.sqlite
sqlite> .tables
RelDb.collectionRelationship contentStatus
RelDb.contentRelationship genres
RelDb.leagueRelationship recordingFilter
RelDb.localizedString syncedContentStatus
accountLevelSettings syncedThumbs
collectionActivity thumbs
The tables from this 2nd database will be accessible via prefix of the database:
sqlite> select count(*) from RelDb.localizedString;
2442
But who knows how to specify multiple database files from the command line to execute the query from the command line?