Differencing between two files

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?

I have a feeling that you are looking only for the part numbers and not the entire fields for the parts which are not in 1 file or the other

if so..use the diff and cut the partnumber and then do a uniq sort or uniq..

cat diff_file | cut -d" " -f2 | sort -u

or insted or sort use, uniq -d..whatevevr..In this way, you get the parts which u may want to reporcess..

cheers,
Devaraj Takhellambam

No, I need the entire record but the "key" to the record is the part number.

Can I use awk or sed to get rid of the first "!" from month one?

I was able to run the following with success. I am posting this in case someone else runs across this issue.

awk -F" " '{if ($1 == "-") { print; prev = substr($2,2,10) } else { {if ($1 == "+") { print; prev = substr($2,2,10) } else { {if (substr($2,2,10) != prev) { prev = substr($2,2,10) } else { print; prev = substr($2,2,10) } } } } } }' bndl_diffu2_awk2_sort2.txt > bndl_final.txt