bibtool
bibtool copied to clipboard
Permit negation within the rename.field condition
Perhaps I am mistaken, but it seems from the documentation in A.11.3. (and my limited testing) that the pattern
supported by the useful rename.field {old=new if field=pattern}
syntax provides no means of renaming a field to another, provided the target field does not exist, but only if it does.
I am trying to delete all number
fields and create pages
fields for those missing them, iff the originating field did not have one. That is, entries without any page numbers, such as those with only an article number (which I have under the numbers
field), should have their number
field renamed pages
. I then delete the number
field.
That is, I would like the following or an equivalent to work:
-- 'delete.field {number}' -- 'rename.field {number=pages if
not
pages}'
Is there a workaround that I could use to accomplish this and if not could this feature be added?
This goes in line with #11. I am working on it towards a major release 3.0. But this may take some time. I will think about an intermediary solution. In the mean time the work around might go along the following pattern:
- Use BibTool (twice) to generate two files by selecting those containing a number and those which don't. This can be done since the selection mechanism is more powerful.
- Then process the single files separately
- Join the two files afterwards.
Great and thanks for the workaround!