• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Duplicate contacts

andyd134

Lurker
I appreciate there are a number of threads on this topic, but none seem to answer my problem:

I had all my contacts duplicated - not from another source - I think it may have been the network provider's backup app

I tried merging, but the app I used also added in google and facebook contacts, but then refused to merge these all into one (didn't even seem to be an option to do it manually)

I have now ditched that app, going back to the stock contacts app, and have simply turned off google and facebook contacts
However, I'm left with every contact being 'Joined', and the only way I can find to clean this up is to unjoin and then delete by hand for each one

Anyone know of any clever way to do this??

Many thanks
 
Well, there's a way that requires some expertise with text editors. In the Contacts app, open the menu and click "Back up contacts". Take notice of the name of the file that was just created, then copy the file to a computer and open it with a decent plain-text editor (I would suggest vim or Notepad++).

I don't know what the format of the file will be, so I will just give you basic directions: learn the basic structure of a contact entry (I would expect it to begin with "BEGIN:VCARD" and end with "END:VCARD"). Create a regex (if you don't know what that is, time for some learning: regular-expressions.info) that matches that structure, and then delete entries alternately.

If even that process is unfeasible (perhaps if you have 10,000 contacts) you could try something using some linux tools, let us know if that is the case.

When you finish removing the duplicates, save the file with a different name. To make sure everything's right, do the following checks: get the number of lines in the initial file and its size (in bytes) and divide each value by 2. Round the numbers up. (That is because of a possible line feed character in the end of file.) Check whether those values are the same verified for the final file; if so, you probably got it right. Make backups (IMPORTANT!) and delete all contacts from your phone, then import the file you generated in the text editor using the Contacts app.
 
Back
Top Bottom