Combining Accounts
Eric Angell
eric at magicpacket.net
Mon Oct 25 18:30:05 EDT 2004
On Wed, Oct 20, 2004 at 15:41:14 -0300, Jon Lapham wrote:
> Phil Scherzinger wrote:
> >I am doing some home cleaning and need to know if there is an easy
> >way of combining accounts? For example, I have an account
> >"expenses:penney" and one "expenses:penneys" I would like to combine
> >them into "expenses:penneys"
> >
> >Any thoughts?
> >
>
> http://www.gnucash.org/docs/v1.8/C/gnucash-guide/appendixb_using.html#appendixb_using_moveAtoB
That's not entirely accurate - if you're willing to get your
hands a little dirty, you can do the account combining in a
fairly quick automated fashion.
First, quit Gnucash. Find your data file and make a copy of it -
we'll work on the copy in case something gets messed up. If it's
compressed (based on your preferences), run gzip -d on it (you
might have to rename it to have a .gz extension first). Now it
should be plain XML. Open it up with your favorite editor (e.g.
gvim), and locate the accounts you care about - the names that
you see in the program should appear as
<acct:name>penney</acct:name>. Immediately after that line
should be a line of the form <act:id
type="guid">9a745be82ce758dd92698dde3a4b282c</act:id>. Take the
long hexadecimal string (the id) from penney and do a global
search and replace with the one from penneys. However, if you
don't want to delete all of the account-info lines related to the
penney account right now, make sure that its id string remains
unchanged. You only really want all of the transactions to
change. Also note that if you decide to delete the account by
hand, you should change the counter that keeps track of how many
accounts exist. It's near the top of the file.
Save and (optionally) gzip the file (renaming to remove the .gz
extension), and use it as your new data file. If you're
satisfied that you didn't destroy it, you can remove the original
file and use the new one instead.
Obviously, this is a somewhat delicate operation and not for the
faint of heart, but if you have tens or hundreds of transactions
that need changing, this is the fastest way to do it.
Also note that if there were any transactions existing between
expenses:penney and expenses:penneys, they will be somewhat
strange now. There are probably other dangers to this that I've
failed to document. Use at your own risk, yadda yadda.
-E
--
A man's ethical behavior should be based effectually on sympathy,
education, and social ties; no religious basis is necessary. Man
would indeed be in a poor way if he had to be restrained by fear
of punishment and hope of reward after death.
--Albert Einstein
More information about the gnucash-user
mailing list