I have two csv files having 90K records each & each row has around 50 columns.Lets say the file names are FILE1 and FILE2. I have to compare both the files and generate a new file that has rows from FILE2 if it differs.
FILE1
-----
2001,"John",25,19901130,21211.41,Unix Forum
2002,"Mike",26,19850101,0.0,"Linux Experts, Co."
FILE2
-----
ID,NAME,AGE,JOINDATE,SALARY,ORGANIZATION
2001,John,25,19901130,000000000021211.41,Unix Forum
2002,Mike,26,19850101,000000000000000.00,"Linux Experts, Co."
As you can see that the text values in one of the files are quoted and the salary field differs in format but not the values. Both the files are same right now and the only difference is the missing header. So the output file must have the header only.
Lets change the data in FILE2
FILE2
-----
ID,NAME,AGE,JOINDATE,SALARY,ORGANIZATION
2001,John,25,19901130,000000000021211.41,Unix Forum
2002,Mike,26,19850101,000000000000000.00,"Linux Experts, Co."
Now, the output file should have the header and row2 from FILE2.
Please suggest an awk command to do this.