[Tex/LaTex] Filter .bib file for items that are actually used with \cite?

bibtexscripts

Possible Duplicate:
How to split all BibTeX referenced entries from a big BibTeX database to a copy?

I have one big foo.bib file that contains all my references. Every one of my different LaTeX documents uses this with \bibliography{foo} and cites only a subset of the contained references.

Is there a good script that takes one of my LaTeX documents (including everything it includes using \input) and extracts all the items in foo.bib that are cited?

In other words, I'd like to filter the big foo.bib file using a LaTeX document so that only the cited bibliography items survive.

Best Answer

I think there are some perl scripts doing that.

But I use RefTeX which offers a function reftex-create-bibtex-file that does just that.