This problem has been solved umpteen times in these forums. Did you bother to search, or look into the proposals given below under "More UNIX and Linux Forum Topics You Might Find Helpful"?
Note that RudiC's and Scrutinizer's suggestions both depend on the fact that the orgX and orgXX strings in file2 are distinct. Had file2 also contained the line:
org2=japan
both of those suggestions might randomly have resulted in japan9 appearing in the output instead of america , japan3 appearing instead of europe , and japan2 appearing instead of china .
If this might be a problem for you, you would either need to be sure that all of your orgXX strings are the same length or sort your orgXX values by decreasing numerical value of XX and process the substitutions from beginning to end in sequence (like Scrutinizer did) instead of using for (r in REP) (like RudiC did).
And, if using Scrutinizer's code and a single orgXX string might occur more than once in a line of input (which does not happen in your sample), you would need to use gsub() instead of sub() to get the desired results.
Yes that is correct, #3 uses exact strings, so it correctly identifies the right field, and the sub() in itself isn't the problem either, since iteration occurs over the fields and not over the key value pairs (therefore it can substititute multiple occurrences on one line), but the problem is in the replacement part, it was attempting to use sub() on the record instead of a direct assignment to the field, to avoid losing the file separators.