I have a .bib file that contains every paper I have on my computer (linked to pdf with Jabref). When I work with a specific project, I only need a subset of these papers (the entire file contains hundreds of entries, way too much). So, I would prefer to have a separate .bib file that contains only the relevant entries. Since I want to manage all the BibTeX entries in a central place and use them separately, it would be great if there is any program that can programmatically (from command line) generates a subset of the BibTeX entries based on a list of information, say, a list of titles. (But not from .aux, as I would need to collect a subset of the original large .bib file before I actually write out the .tex file.)

I know that I could use the "Group" function in JabRef and save all entries in a group as a new .bib file. However, the problem is that this method relies on "GUI operation". I would prefer something run from a script (e.g., Bash or Python) that can be triggered by an event (say, a post-commit hook in Git).

The main advantage of always generating subsets of BibTeX database from a single central database is that every time I need to fix some error or update something in the entries, I can do that in the central database and immediately get an update in all of the other smaller databases by running the script.

Does such a programmatical approach of generating .bib file already exist? Thanks!

  • I think JabRef has a CLI, not sure which operation it supports, though. Several tools that could have the functionality you look for are listed in tex.stackexchange.com/q/41821/35864. Several scripting languages have .bib parsers and so they could be used as well (there are some Python scripts for .bib files out there)...
    – moewe
    Jul 12 '18 at 10:47
  • 1
    bibtex2html contains a CLI tool bib2bib which can filter .bib files for given criteria. In addition, it has aux2bib to create a .bib file with the citations mentioned in the .aux (those are the ones cited).
    – Alex
    Jul 12 '18 at 20:22
  • @Alex I tried a little bit with bib2bib and it seems to be the most ideal tool for my purpose so far. Thank you so much for your information!
    – Norman
    Jul 13 '18 at 11:58

Your Answer

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

Browse other questions tagged or ask your own question.