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.
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}
}
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.
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)
bibtool? – Andrew Swann May 24 '17 at 12:35bibtool -r bibtool.res ref.bib -o ref-fix.bib, wherebibtool.rexis a file containing the linedelete.field = { abstract }. Thanks! If you post an answer I'll accept it. – a06e May 24 '17 at 14:50