Unexpected "notes updated"

I’ve been noticing lately that when I add forty or fifty notes to a text file and import, Anki says # notes added, # notes updated, # notes unchanged

The second number is generally in the neighborhood of 150. Now every time I add notes, I generally edit a few—but never even a hundred.

So, tonight, I imported the file with 56 new notes and three changed.

It said 156 updated. Without even opening the file, I imported the same file again, and it said 148 notes updated.

What is being updated?

I suggest you export the notes to a text file and compare the result with the text you’re importing to see what’s different.

I exported the deck and did a sort -u on both import and export and deleted the unnecessary quote marks from the export.

sdiff on the sort results said that every line was different, but I could not see any difference. I piped sdiff into od -xc and could not find any differences.

So I tried head -2 /tmp/{IN,OUT} | od -xc and verified that the first lines are NOT different!

So, I imported the same (unsorted) unedited file again, and it again said “148 notes updated.” I did a check DB and imported again: same result.

If there is something in the import file that Anki doesn’t like and alters during import, I cannot find any evidence because either od -xc or diff/sdiff is giving false output!

Just now, I added 18 notes to the file, changed no previously existing notes, and imported.

Said 18 added, 148 updated.