I got a requirement where I need to compare two files wrt to each columns and write the corresponding difference in another file along with some identification showing mismatched columns. Pointing out the mismatched columns is my main problem statement. For example we have files like:
File 1
1|piyush|bangalore|dev
1|piyush|bangalore|QA
2|pankaj|bangalore|dev
3|rohit|delhi|QA
File 2
1|piyush|bangalore|QA
1|piyush|bangalore|QA
2|pankaj|bangalore|dev
3|rohit|bangalore|dev
The expected output file looks somewhat like.
File 1
1|piyush|bangalore|**dev**
File 2
1|piyush|bangalore|**QA**
File 1
3|rohit|**delhi**|**QA**
File 2
3|rohit|**bangalore**|**dev**
I want to achieve something like this where i can see the mismatched columns as well along with mismatched rows. I have tried
diff File1 File2 > Diff_File
But this is giving me only the mismatched records or rows. I am not getting any way to point out the mismatched columns as well. Please help me out if its possible to do is using shell script or awk command as i am very new to this. Thanks in advance.
3|rohit|**delhi**|**QA**
row within your input files. Update your expected output