These tricks require BibTool, which can be installed using homebrew
.
To extract only the used fields call bibtool -x
on a .aux
file, e.g.
bibtool -x doc.aux -o output.bib
To delete fields that you don't want to share, e.g. notes and file locations,
bibtool -- "delete.field {annote}" -i input.bib -o output.bib
bibtool -- "delete.field {file}" -i input.bib -o output.bib
An easier way to deal with multiple options is to create a resource file, mine looks like this and its meant to "clean" mendeley generated bibtex files, yet modify them minimally:
delete.field = "annote"
delete.field = "file"
delete.field = "keywords"
delete.field = "abstract"
delete.field = "mendeley-tags"
preserve.key.case = on
print.align.key = 0
print.indent = 2
print.align = 0
print.line.length = 9999
print.wide.equal = on
print.equal.right = off
print.use.tab = off
You can call this file directly with the -r
option, e.g., bibtool -r res_file -i input.bib -o output.bib
, or save it in the current directory, or in the $HOME
directory as .bibtoolrsc
, so that you don't have to use the -r
option.
More options and documentation here: http://www.gerd-neugebauer.de/software/TeX/BibTool/bibtool.pdf