parse apl-numeric codes from filenames, and match them to entries in database

Hello,

I am new to Unix scripting, and would like some help with my issue:

I have vairous files having some alphanumeric codes in them e.g.

10000-01
34440TE
34590SR

All these codes are stored in the database, and I need to parse these codes out of these filenames, and match them with the database entries.

For instance:
File Name: 10000-01 Western Region.xls should match with database code 10000-01 or

South Region perf-34590SR.xls should match with database code 34590SR.

Also, the script should give me the code coming in from the filename in a variable.

Any help will be greatly appreciated for this critical task I have on hand.

Thanks,
Mel.

codefile=/path/to/file/with/codes
datfile=/path/to/data/file

matching_records=$( grep -f "$codefile" "$datafile" )

Thanks for your quick response. I will try this and let you know.