bibtool icon indicating copy to clipboard operation
bibtool copied to clipboard

Conditional fields deletion

Open giacomolanciano opened this issue 4 years ago • 0 comments

As per the user manual, you can specify keep.field {field_1 if field_2 = "pattern"} to retain field_1 if field_2 matches the pattern regex (and discard it otherwise). Although, the same syntax is not supported for delete.field.

For instance, if such a conditional deletion was supported, my primary usecase would be to remove ArXiv-related fields from a record that also has a DOI. I would like to be able to do that by specifying

delete.field { {arxivid archiveprefix} if doi = ".+" }

AFAICS, it is not possible to achieve this result by using keep.field (e.g., by specifying the fields that are complementary to the ones to be deleted) because, for all the records where the condition does not apply, all the fields will be deleted.

Is it possible to add support for conditional fields deletion?

giacomolanciano avatar Oct 01 '20 10:10 giacomolanciano