To read a particular field on a record in one file and alter it in another, you probably want to use awk.
This does seem like a homework problem, so I hope I'm not doing your work for you.
There is a book called "Gawk: Effective Awk Programming" that you may be able to install if you have a "gawk-doc" package, although sometimes it is supplied by the gawk package or the gawk source package. You didn't indicate your distro in Your user profile, so I can't be more specific. I have SuSE, and installed the gawk src.rpm file, and then used "rpmbuild -bp" to patch the source followed by "./configure && make pdf" to produce the pdf version of the book.
If you have Fedora Core, it is installed at /usr/share/doc/gawk-<version>/gawk.ps