Shell script to replace fields in one file from a value in another file
Posted on 2007-11-21
I have file with a similar format
There are about 10,000 records with the same format as above.
There is another file which has the mapping of codes in the above file
I need to write a script that would replace all the fields in column 2 of the first file above with the second column (based on the mapping code) of the 2nd file.
For eg.. in the 1st file if the line was
after the transformation
It has replaced CODE1 with 002001 .
I tried to use awk and sed, but somehow am not able to get the solution.
Is there any better way to do it like using perl or any other technology.
Help is greatly appreciated !