I have two files. One from last month and one from this month. I need to identify the differences between the files so I can process only the differences. I ran the following command:
diff -C 1 bndl1111980740907_sort.txt bndl1131363071007_sort.txt > difftest.txt
It gave me a "-" in the first field for records in month one that are not in month two, great. It also gave me a "+" in the first field for records in month two that were not in month one. I'm good with that. I get a "!" for the records that are different between the two months. The problem is that I am getting two records when month two's record is different than month one's record. I get one "!" for month one and one for month two (month one always appears first). I only want the record for month two.
Is there a way to do this with diff and still keep the "+" and "-" records? I want only one "!" from month two. If I can do it with diff, can I use awk to filter out the second "!"?
Here is an example of the diff file.
+ C00000000DC* DCNS7 00121030416 000000000000000000000000000000000000000000000000000N1N01 C
! B0000ATC5 E 005080170029 A000035000020000000000000000019000000000000000000000 1P07EC
! B0000ATC5 E 005080170029 A000035000020000000000000000019000000000000000000000 1P09EC
! B0000ATM5 E 005080170029 A000050000030000000000000000029000000000000000000000 1P19EC
! B0000ATM5 E 005080170029 A000050000030000000000000000029000000000000000000000 1P21EC
! B00015866 E 00121109015X A001310000785000000000000000746000000000000000000000 1P11 B
! B00015866 E 00121109015X A001310000785000000000000000746000000000000000000000 1P12 B
! B00079583 E 001140890101 B003645002185000000000000002076000000000000000000000 1P01 C
! B00079583 E 001140890101 B003645002185000000000000002076000000000000000000000 1P02 C
! B000ATC10 E 005080170029 A000045000025000000000000000024000000000000000000000 1P24EC
The field that contains the part number is in position 4-13. For example, I would only want the second "!" record for part_number "00015866 ".
Can anyone help me?