sqlite3 register.db if ‘exp’ is the expression you’re looking for (e.g. ‘%qt4%’ for all files containing …qt4…) sqlite> WITH i AS (SELECT id FROM files WHERE path LIKE exp GROUP BY id) SELECT name FROM ports, i WHERE ports.id = i.id; Assuming you want the name of the ports which provides the files you’re looking for Vincent