0

data1.csv

20180318,2121,111,0
20180318,3131,111,0
20180318,4141,111,1
20180318,5141,111,1
20180318,6161,111,0
20180318,8181,111,1
20180318,9191,111,1
20180318,9999,222,1

data2.csv

20180319,2121,111,1
20180319,3131,111,1
20180319,4141,111,0
20180319,5141,111,1
20180319,6161,111,0
20180319,8181,154,0
20180319,2323,111,1

I want to update the 4th column of data2.csv by the 4th column of data1.csv where 2nd and 3rd columns are same in both the files. But I want to update only if the value of 4th column in data1.csv is 0 and 1 in data2.csv. If the value of 4th column in data2.csv is 0 then ignore it and leave as it is. Only for the values which are 0 in data1.csv and 1 in data2.csv I want to update data2.csv.

output should be like:

20180319,2121,111,0
20180319,3131,111,0
20180319,4141,111,0
20180319,5141,111,1
20180319,6161,111,0
20180319,8181,154,0
20180319,2323,111,1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.