bibtool -s bibliography1.bib bibliography2.bib
will merge two bib files, keeping duplicate entries. bibtool -s -d bibliography1.bib bibliography2.bib
will merge two bib files, commenting out one of the duplicated entries (not sure which one). For more info, see documentation.
Bibtool
is on CTAN. Not to be confused with bibtools which is also on CTAN and probably also has the capacity to do this sort of thing...
Bibtool can also be found in Ubuntu repositories. (I wasn't able to compile the one from CTAN)
You can set up Jabref to automatically import a reference from Firefox into the current database, but it's somewhat arcane. Here is my solution under Linux:
1) Select Options -> Preferences -> Advanced -- and check "Listen for remote operation ..." I don't think it matters which port.
2) Create a small bash script (text file) named "jabref-import" that looks like this:
#!/usr/bin/env bash
java -jar ~/local/jabref/JabRef-2.8.1.jar -i --importToOpen "$*"
Replace "~/local/jabref/JabRef-2.8.1.jar" with the path to your Jabref .jar file on your machine. Or if you have a working executable called "jabref", you can replace everything before the "-i" with "jabref". Just make sure your executable accepts command-line options (mine didn't).
In Ubuntu 13.04, the following variant of the script works:
#!/usr/bin/env bash
jabref -i --importToOpen "$*"
3) Make the file executable:
chmod ugo+x jabref-import
4) Make sure Jabref is already open. Go to Firefox, download a citation file. It could be a .bib or .ris or .ref or whatever. Select the "Open with..." option in the dialog, and select the jabref-import executable that you just made. The import dialog should pop up in Jabref with your citation.
Best Answer
Is the goal just to create a
.bib
file with all the unique references, or to create a single printed bibliography to tack onto the back of all these different documents? If the former (I'm making this assumption because you say that the source documents have "various incompatible classes", etc), then Bibtool and its "extraction" option is your friend. I haven't tested this, but assuming bibtool is installed, if you run latex/bibtex on each separate.tex
file, so that the.aux
files are generated, then I believe something likewill move you toward what you want. See p10 and pp27-28 of the bibtool manual. Even if the goal is a single printed bibliography, however, it will be straightforward to produce one once you've created the consolidated
.bib
file.