Comparing two files in unix and awk

awkdiff()file-comparison

I have to compare two files, file1 and file2. Each file has 56 columns separated by |.
First column is the employee number in the file, I will check whether same employee number is present in the second file or not. If not we will write the whole row to the output file. If same employee number is present in the file2, I need to compare value of each column. If data doesn't match, we have to write it to the output file. If values of each column match then we need to omit that record.

Sample File
File 1

2620|256034|131021|Mission Quality and Wipro Way|||
2622|256034|131021|Mission Quality and Wipro Way|||
2623|256034|131021|Mission Quality and Wipro Way|||

File 2

2620|256034|234567|Mission Quality and Wipro Way|||
2621|256034|131021|Mission Quality and Wipro Way|||
2622|256034|131021|Mission Quality|||
2623|256034|131021|Mission Quality and Wipro Way|||

Sample Output:

2620|256034|131021|Mission Quality and Wipro Way|||
2621|256034|131021|Mission Quality and Wipro Way|||
2622|256034|131021|Mission Quality|||

Best Answer

If files are sorted much easy do the task by diff

comm -13 File1 File2
Related Question