How do I check using shell-script if an item is available in a database?

Input for the program is a text file consisting of n no. of items.

I want search each item in a database and the existing parts should go to FOUND folder and the others should go to NOTFOUND folder.

Pls help me in this.

Thank u.

What kind of database is this??