bibtool icon indicating copy to clipboard operation
bibtool copied to clipboard

Permit negation within the rename.field condition

Open cviner opened this issue 8 years ago • 2 comments

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 ifnotpages}'

Is there a workaround that I could use to accomplish this and if not could this feature be added?

cviner avatar Aug 04 '16 00:08 cviner

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.

ge-ne avatar Aug 04 '16 06:08 ge-ne

Great and thanks for the workaround!

cviner avatar Aug 04 '16 13:08 cviner