6

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.

a06e
  • 1,098

3 Answers3

8

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

@Article{test,
  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}
}
Andrew Swann
  • 95,762
2

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.

  • 1
    In Overleaf one has to escape the curly brackets (regexp mode on): abstract = {.*} Also, the empty lines can be removed by replacing the following with nothing: ^$\n – Adriaan Mar 07 '24 at 13:52
0

Outstanding recommendation from Carlo!

If you are using Linux xed, you can use the following:

abstract={[^}]*}

Nowadays, you can also use an online AI service to help you with regular expressions with varied content.

(I can't comment because I don't have the requisite credits)