compare
Posted: 14 Oct 2010 07:52
Hi ghost critical problem for me.can u help me
file1.csv
GJR10101315511000145,22093165,96734353,250,GJR,UER
HPR10101318071200662,57298772,03289112,250,HPR,DLR
HPR10101317581100059,57651616,02894754,250,HPR,DLR
HRR10101318031000352,02190237,03963371,250,HRR,DLR
HRR10101322141200125,02191868,03426983,250,HRR,DLR
HRR10101318071100028,02192292,77203779,250,HRR,BHR
KOR10101317231000008,04090878,14635365,250,KOR,WBR
KOR10101315171200004,04798063,14367284,250,KOR,WBR
KOR10101316291200024,13996348,97000215,250,KOR,BHR
file2.csv
KOR10101315511000150,57457784,250
GJR10101315511000145,96734353,250
UER10101315511000150,66734353,200
HRR10101315511000151,96734353,206
UER10101315511000164,96734353,200
UER10101319451200169,96734353,250
GJR10101315511000145,96734353,206
........
.n numbers.....
.......
GHR10101315511000150,36646466,200
HPR10101318071200662,03289112,250
HPR10101318071200662,03289112,206
DLR10101318071200664,03289112,206
OUTPUT:
FILE3.CSV
UER10101315511000164,96734353,200
DLR10101318071200664,03289112,206
Let me explain..
now i have to get column 1 removing first three character in file1.csv Eg:-like(10101315511000145) and add that 6th column to it like(UER10101315511000145).Now from 145 i have to increament+1 till 999 to it and compare column1 from file2 whichever number appears first it should display that line from file2.csv....so here i get UER10101315511000150 but 2nd colum doesnt matches to 3rd column in file1..so i have to go for next increament which matches that too.
thanks in advance
file1.csv
GJR10101315511000145,22093165,96734353,250,GJR,UER
HPR10101318071200662,57298772,03289112,250,HPR,DLR
HPR10101317581100059,57651616,02894754,250,HPR,DLR
HRR10101318031000352,02190237,03963371,250,HRR,DLR
HRR10101322141200125,02191868,03426983,250,HRR,DLR
HRR10101318071100028,02192292,77203779,250,HRR,BHR
KOR10101317231000008,04090878,14635365,250,KOR,WBR
KOR10101315171200004,04798063,14367284,250,KOR,WBR
KOR10101316291200024,13996348,97000215,250,KOR,BHR
file2.csv
KOR10101315511000150,57457784,250
GJR10101315511000145,96734353,250
UER10101315511000150,66734353,200
HRR10101315511000151,96734353,206
UER10101315511000164,96734353,200
UER10101319451200169,96734353,250
GJR10101315511000145,96734353,206
........
.n numbers.....
.......
GHR10101315511000150,36646466,200
HPR10101318071200662,03289112,250
HPR10101318071200662,03289112,206
DLR10101318071200664,03289112,206
OUTPUT:
FILE3.CSV
UER10101315511000164,96734353,200
DLR10101318071200664,03289112,206
Let me explain..
now i have to get column 1 removing first three character in file1.csv Eg:-like(10101315511000145) and add that 6th column to it like(UER10101315511000145).Now from 145 i have to increament+1 till 999 to it and compare column1 from file2 whichever number appears first it should display that line from file2.csv....so here i get UER10101315511000150 but 2nd colum doesnt matches to 3rd column in file1..so i have to go for next increament which matches that too.
thanks in advance