1

I just ran bibtool on my bib file (managed with BibDesk) to remove the abstract fields (with thanks to ananswer to Remove abstracts from .bib?). However, doing so removed the @comment line added by BibDesk.

Is there a way to preserve the @comment line (and my static groups!) when running bibtool?

1

The option pass.comments=on preserves comments by "attach[ing] them to the entry following them" [1]

Hence, the following one-liner solves your question:

bibtool -- pass.comments=on -- delete.field={abstract} bibdesk.bib -o bibdesk_cleaned.bib

You might want to specify these options in a bibtool *.rsc file and load it using -r preserve_bibdesk.rsc. I tried to mimic the output format of BibDesk with such a bibtool resource file as closely as possible here: https://github.com/ge-ne/bibtool/files/4906579/preserve_bibdesk.zip

Notice that bibtool might affect fields with newlines (e.g., if you 'misuse' the Annote for comments) because "BibTool assumes that the text is typeset with (La)TeX at the end. Thus the rules for this target are taken into account." [3] Hence bibtool eliminates single line breaks and collapses multiple line breaks accordingly.


[1] BibTool Manual, p29: https://mirror.easyname.at/ctan/biblio/bibtex/utils/bibtool/bibtool.pdf

[2] BibTool Quick Reference: https://mirror.easyname.at/ctan/biblio/bibtex/utils/bibtool/ref_card.pdf

[3] BibTool author clarifying newline behavior: https://github.com/ge-ne/bibtool/issues/77#issuecomment-657127528

Your Answer

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

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