I want to remove all abstracts from a .bib (bibtex) file. I am constantly sending this file back and forth by email and currently the size is too large.

Note that the abstract field has multiple lines, so the grep approach here does not work.

  • 1
    Have you looked at bibtool? May 24 '17 at 12:35
  • 1
    gzipping it is likely to be easier, and make it smaller May 24 '17 at 12:41
  • oh, I found it. bibtool -r bibtool.res ref.bib -o ref-fix.bib, where bibtool.rex is a file containing the line delete.field = { abstract }. Thanks! If you post an answer I'll accept it.
    – becko
    May 24 '17 at 14:50
  • no I meant just use gzip to make your file smaller and don't worry about the abstracts a typical bib file will compress a lot May 24 '17 at 14:50
  • @AndrewSwann answer requested ^^ :-) May 24 '17 at 14:50

A good tool for this sort of operation is the program bibtool. To use it for removing particular field you need to create an resource file e.g. remove-abs.rsc containing the line

delete.field = { abstract }

Then invoke this on your original bib file orig.bib as

bibtool -r remove-abs.rsc orig.bib -o new.bib

  author =   {Author, A.},
  title =    {A title},
  journal =  {J. Jour.},
  year =     2000,
  volume =   3,
  pages =    {6--23},
  abstract =     {Abstract text to be removed}

this produces

@Article{     test,
  author    = {Author, A.},
  title     = {A title},
  journal   = {J. Jour.},
  year      = 2000,
  volume    = 3,
  pages     = {6--23}

You can just use a text editor, like Sublime. Activate the Regex function (option+command+R on Mac) and look for:

abstract = {.*},

and substitute it with nothing.

This removes anything between abstract = { and },

You can apply this to other fields.

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.