I am using find to find names of databases that return some rows for a query.
$ find . -name 'sqlite.db' -exec sqlite3 "{}" 'SELECT * FROM table WHERE column1="value"' \;
value|a|b|c|d
But I want the name of the database, so I tried -print which showed all the names
$ find . -name 'sqlite.db' -print -exec sqlite3 "{}" 'SELECT * FROM table WHERE column1="value"' \;
/dir1/a/sqlite.db
value|a|b|c|d
/dir2/a/sqlite.db
/dir2/b/sqlite.db
/dir3/a/sqlite.db
Is there a way I can get only the files where the exit status of the command run is success.