4

Mine is closely related to this one: Creating .bib file containing only the cited references of a bigger .bib file

I ask the same question but with a solution for Windows. The mentioned solutions bibexport, and bibextract don't seem to be available. I think it's possible to run these programs through something like MinGW, but I'd like to be able to have something that works on the command line so that I can build it into my usual build command.

Any help is very much appreciated.

0
7

If biblatex/biber is an option, you can use biber to generate a document-specific .bib file. All you need is a document using biblatex compiled to generate the usual .bcf which biblatex/biber uses. Then you can run:

biber --output_format=bibtex --output_resolve <filename>.bcf

where <filename> is the name of your <filename>.tex.

6
  • I do prefer biblatex/biber, but it is not supported in the Elsevier elsarticle template yet. – kennyB Nov 14 '14 at 21:54
  • 1
    @kennyB You could use it to produce the .bib file, though, couldn't you? You don't need to then use it for the article itself. – cfr Nov 15 '14 at 0:29
  • I think bibtex only produces an .aux file, whereas biber produces a .bcf? Right? – kennyB Nov 20 '14 at 1:25
  • @kennyB Yes. But you can use the .bcf to create a .bib file. Then run TeX again with BibTeX setup and use the custom .bib file. The .bcf is just needed to create the .bib file. That is, I'm not sure what point you are making/asking about? – cfr Nov 20 '14 at 1:33
  • Sorry I wasn't clear - when using the elsarticle template, I'm restricted to using natbib with bibtex as it's built in to the .cls file somehow. So, when I generate the document, there's no .bcf to use the above command with. Is there an aux to bcf tool out there? Thanks! – kennyB Nov 20 '14 at 18:04
3

If you don't mind installing jabref, it can do it for you. Both command line (link here) and gui options are available. From command line do

jabref.jar -a filename[.aux],newBibFile[.bib]

You should be done. Take care that jabref.jar is in system path, and run this command from the same folder as your .aux file.

5
  • Hi @HarishKumar, I have tried this solution with the following command: <aux file location>>JabRef-2.10.jar -a bellEtAl.aux,bellEtAlCited.bib The behavior is simply to open the JabRef Gui and nothing else happens. What am I doing wrong? Thanks so much – kennyB Nov 14 '14 at 22:15
  • I have managed to get this to work through the GUI as well. So at least a have a partial solution. – kennyB Nov 14 '14 at 22:44
  • @kennyB Can you try jabref -a bellEtAl.aux bellEtAlCited.bib source.bib where source.bib is your master bib file? – user11232 Nov 14 '14 at 23:26
  • I first delete bellEtAlCited.bib, then run the above command. When I try this, the behavior is again to open the JabRef GUI with source.bib open and the error message Error opening file bellEtAlCited.bib. null. – kennyB Nov 16 '14 at 22:40
  • @kennyB It looks like a bug :( – user11232 Nov 16 '14 at 23:00

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