Firstly, you have completely misunderstood how the "My Clippings.txt" file works. It is a simple log of the annotations you made using the device. The location is just an approximation and should match the page number shown when you make the annotation, Trying to match that back to the book is not going to work except by doing text search. There is another file on the device that has location details that are used to show the highlight when reading. There are some details about this somewhere in the Kindle forum. I see you posted the question in the Kindle forum, so someone will probably come along with the details there.
For Kobo devices, the annotations are stored in the database. This includes the location in the book. It isn't hard to use that to work out where in the book it is. But, it only works for that edition. If the book is formatted differently, then you will probably have to resort to a text search again to find the location.
There are a few things around that will read the annotations from the database. Such a a function in calibre, the Annotations plugin and my Kobo Utilities plugin. There are other scripts around to do it. I have posted a list of all the methods I know about occasionally. A search should find it and I don't think anything has changed. Looking at any of those will show how it works.
|