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.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityA 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.
bibtool
?bibtool -r bibtool.res ref.bib -o ref-fix.bib
, wherebibtool.rex
is a file containing the linedelete.field = { abstract }
. Thanks! If you post an answer I'll accept it.