[GNC] Transcation Search & Replace

Kevin Buckley kevin.m.buckley at gmail.com
Fri Jul 3 03:23:37 EDT 2020


On Fri, 3 Jul 2020 at 04:00, listsub3 <listsub3 at liberator-systems.co.uk> wrote:
>
> Typically bulk search replace changes would be for things like
> transaction category/account, changes in names in description/notes. etc.
>
> My GC data folder is currently 46mb (I have quite a lot of histrorical
> stuff).
>
> Seems like quite a functional omission in GC to me - it must be quite a
> common user task - I don't have an old Quicken on this machine but I
> know it used to be a breeze with that.
>
> Searching this list I found an an old response to the same question
> which indicated that this functionality would only be considered once GC
> had moved to a databese strcuture?

Not clear that one needs a database to do much of what you've listed
above, although an SQL syntax might offer extra capability, as regards
say, more easily narrowing the change down to a specific set of transactions.

If you have the XML file, then altering a common description string across
multiple transactions in the file, is a simple text-editing, find-and-replace
operation.

These two pseudy-coded examples are equivalent
(Note: not the actual Table names nor XML schema tags)

UPDATE TXN t SET t.description = 'corrected string' WHERE
t.description = 'erronenous string' ;

sed -ie 's/txn:description>erronenous
string</txn:description>corrected string</'  myfile.xac


Changing category/account, as opposed to editing their names, is a little
harder, because of the indirection through the GUIDs, but again, once you
have identified the "GUID string" representing the name of the category/account
string that you wish to change, and the "GUID string" for the category/account
that you wish to change to, then again, it's now just a
find-and-replace exercise.

Not saying that XML is easy to read, and some would it should never be read,
but for some changes, it does offer an option.

Do make a backup, if you are going to experiment, though.


More information about the gnucash-user mailing list