Can I set a custom field with the cli?

I have an RT install used to track bugs in various products, there is a
queue per product: productX, productY, productZ, etc. I want to get rid
of these queues and instead create a custom field ‘product_id’ to apply
to each ticket. As there are quite a few active tickets I want some
automation to handle moving the tickets to a generic queue and applying
the custom field.

Using the cli …

I can list tickets based on a custom field:

$ rt ls -t tickets -i “‘CF.{product_id}’=‘productX’”
ticket/1

But I can’t edit a ticket to update a custom field:

$ rt ls -t tickets -i “Queue=‘productX’” | rt edit - set
“‘CF.{product_id}’=‘productX’”

Syntax error.

‘cf.{product_id}’: ‘productX’
id: ticket/1

I would like to be able to do something like this:

#!/bin/bash
for ticket in `rt ls -t tickets -i “Queue=‘productX’”; do
rt edit $ticket set ‘CF.{product_id}’=productX
rt edit $ticket set Queue=General
done

Is it even possible to fiddle custom fields with the cli?
Is there a better way to do this than that I am attempting?

dave
rt-3.4.2, apache-2.0.54 + FastCGI, postgresql-7.4.8, perl-5.8.6, FreeBSD
5.4-REL-p6