data sampling

I have a requirement where I have multiple flat file sources.
I need to create sample data from each source.
Example:
Source 1 has 10 flat files--
member, transaction,item,email,....etc
Now if I get any 10 records (say first 10 records) from the member flat file, I need to find those matching members in the rest of the files (transaction, email,etc) using the respective keys.

Any help would be appreciated.

Seems like a requirement for big task.

What you have tried so far ?!

I was going to try thru a SAS dataset but that is something which will take more time....so I wanted to explore some options in unix....not sure yet...
Have you tried doing something like this thru a script?