Your over all plan should go something like this:
1. sort the files so that each line is in the same order.
2. iterate (that is, loop) through the files line-by-line, doing this:
a. check the name to make sure the lines match as expected
b. extract the information you need.
c. dump the info into a new file.
3. move to the next file
There are lots of way to do this, but since it looks like you have pretty distinct fields to work with, I am thinking AWK (great tutorial on AWK here http://www.grymoire.com/Unix/Awk.html
), although you could do it with cut, too.