How to compare a filed of file1 with values in file2
Posted: Sat Apr 06, 2013 12:37 am
Hi,
I have a file 1 with data like below
I have a file2 with data like below
output file should like this: (i.e. CODE value in file1 should compare with 'Min' and 'Max' values of file2 and if it falls in that range, CT value from file2 should be taken and replace in CT value of file1)
please let me know if it can be possible using sort...
Code'd
I have a file 1 with data like below
Name code ind CT
------ ----- --- ---
aaa 123 N ijk
bbb 234 y lmn
ccc 125 n opq
------ ----- --- ---
aaa 123 N ijk
bbb 234 y lmn
ccc 125 n opq
I have a file2 with data like below
ind Min Max CT
---- ---- ----- ----
N 100 125 iii
Y 126 190 jjj
N 191 250 kkk
---- ---- ----- ----
N 100 125 iii
Y 126 190 jjj
N 191 250 kkk
output file should like this: (i.e. CODE value in file1 should compare with 'Min' and 'Max' values of file2 and if it falls in that range, CT value from file2 should be taken and replace in CT value of file1)
Name code ind CT
------ ----- --- ---
aaa 123 N iii
bbb 234 y kkk
ccc 125 n iii
------ ----- --- ---
aaa 123 N iii
bbb 234 y kkk
ccc 125 n iii
please let me know if it can be possible using sort...
Code'd