1

I have a foo.bib file containing duplicate entries, and I want to get a file containing the same entries, but without the duplicates. What tool can I use?

1

The bibtool tool has an option -d designed exactly for that (although it may be hard to find by keywords because the documentation doesn't talk about "duplicate" but about "doubles"):

$ cat foo.bib 
@InProceedings{foo19,
  author =       {foo},
  title =        {bar}
}
@InProceedings{foo19,
  author =       {foo},
  title =        {bar}
}
$ bibtool -d foo.bib -o foo-nodup.bib
*** BibTool WARNING: Possible double entries discovered: 
***     foo19 =?= foo19
***     foo19
$ cat foo-nodup.bib 

@InProceedings{   foo19,
  author        = {foo},
  title         = {bar}
}

###InProceedings{ foo19,
  author        = {foo},
  title         = {bar}
}

By default, entries are only commented-out. You can strip them completely with bibtool -- 'print.deleted.entries = off' -d:

$ bibtool -- 'print.deleted.entries = off' -d foo.bib -o foo-nodup.bib
*** BibTool WARNING: Possible double entries discovered: 
***     foo19 =?= foo19
***     foo19
$ cat foo-nodup.bib                                                   

@InProceedings{   foo19,
  author        = {foo},
  title         = {bar}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.