I am comparing two files file1 and file2, i need to print the updated records of file2 which am comparing in file1. i need data changes of file2 and newly added records
File1:
1|footbal|play1
2|cricket|play2
3|tennis|play3
5|golf|play5
File2:
1|footbal|play1
2|cricket|play2
3|tennis|play3
4|soccer|play4
5|golf|play6
output file:
4|soccer|play4
5|golf|play6
i have tried the below solution but its not the expected output
awk -F'|' 'FNR == NR { a[$3] = $3; a[$1]=$1; next; } { if ( !($3 in a) && !($1 in a) ) { print $0; } }' file1.txt file2.txt
i have compared the column1 and column3 from both files
comm
to get your difference. – BlackPearl