> I need to add to this file the corresponding ranks

Sorry, you don't add anything to a file--you can only read a file and 
then write new output to another file.

In your case, you just make a hash out of the first file.  split() would 
be helpful in that regard.  Then read the second file and use each read 
line(properly stripped of the \n) as the kes in the hash to look up the 
value(the rank), and then write whatever you want to a third file.

-- 
Posted via http://www.ruby-forum.com/.