Many thanks for this. I did discover two minor changes to the formula above that are required for Calibre 1.39. I wanted to keep the ASIN so here's what worked for me:
Search field: {template}
Template: {isbn:|isbn:|, }{identifiers:select(amazon)|amazon:|}
Search for: {template}
Replace with: empty
Destination field: identifiers
Identifier type:*
Mode: Replace field
Split Result: checked
With values separated by:, (i.e., a comma followed by a space)
|