How to check number of group of file.?

Hi Gurus,

I need check existing number of file based on the list in file list.
for example:
in my file list. I have below:

abc, file1.txt
abc, file2.txt
abc, file3.txt
abc, file4.txt
cde, filea1.txt
cde, filea2.txt
cde, filea3.txt
...

in my current file direcotry, I have file:

file1.20130502.txt
file2.20130502.txt
file3.20130502.txt
file4.20130502.txt
filea1.20130502.txt
filea2.20130502.txt

there 4 files for first group abc, after remove date partition (20130502) the files are completed, so, I need log into DB through sqlplus run query select count() from tab where group = 'abc', if count() > 0 then do nothing, if count(*) = 0 then call another script.
for group cde there is one file missing, I need send warning.

anybody can help me this?

Thanks in advance.