changing a large number of transactions in a batch -- impossible?

Anna's unattended mail anna.morris-1okt59qe at cool.fr.nf
Fri Aug 17 09:14:51 EDT 2012


On 2012-08-16, David T. <sunfish62 at yahoo.com> wrote:
>
> First, open the register with the erroneous transactions in it, and
> set the view to Transaction Journal view. Next, get to the split of
> a transaction you want to change, and change it.

I appreciate the feedback from you and Derek.  Your approach is
probably the fastest manual way of doing it, but still quite tedious
for more than 50 transactions, particularly if non-sequential.  If a
batch of transactions with descriptions matching a string are to be
moved, and the batch size is in the hundreds or thousands, I've found
that hacking the XML is (unfortunately) the only practical way.

Suppose your business books are mixed with your personal books, and
you want to create the separation that should have existed initially,
but didn't.  If all transactions containing "Netflix" are not business
related, this is how I would delete them:

  tr '\n' '^' < business_and_personal.gnucash |
    sed 's/\^.gnc:trans/\n<gnc:trans/g' |
    grep -vi '^.....transaction.*netflix.*transaction.$' |
    tr '^' '\n' > business.gnucash

This works only because the caret ("^") character does not appear
anywhere in my gnucash file, so it can be used to temporarily replace
the newlines.  If anyone else attempts this, they should verify that
"grep -c '\^' file.gnucash" is zero first.

Wasn't there some talk a while back about gnucash using sql instead?
That would seem to have more utility than XML, making it easier to
make batch changes that tools do not support.



More information about the gnucash-user mailing list