# [Tex/LaTex] Cleaning up a .bib file

bibtex

I have a large .bib file which is in a mess. In particular:

1. Entries are not in any particular order.
2. Some entries may be duplicates (albeit with different keys).
3. Some entries may not be used in the relevant book.

(1
is an issue because I'm working through the .bib file fixing up items one by one and examining the corresponding changes in the book; at the moment I'm having to dart back and forth a lot.

3 is an issue because I need to check the correctness of each entry manually, which can take a while; thus unused entries mean a lot of wasted time.)

Is there a way of taking a .bib file and cleaning it up? In particular, I'd like to

a) create a .bib file which is sorted by author, and

b) delete or, better, comment out unused entries.

I would recommend bibexport script. It creates a new .bib file that includes only the references you cite in the .tex file, and cleans them up. I use it for submissions to journals, when I want to send only the relevant references rather than my databases.