Perl script for "closing the books" in a GnuCash file

John R. Carter, Sr. john at jrcarter.com
Tue Apr 6 20:17:04 EDT 2010


Doug Pastorello answered the call regarding his script gcCull.pl.

See his post here: 
http://lists.gnucash.org/pipermail/gnucash-user/2009-January/027957.html

The script can be modified to trim everything from before and after a given year. This allows me to filter out individual years for archiving purposes.

$ diff gcCull.pl gcCull2.pl
10c10
< # This version removes transactions prior to the year provided.
---
> # This version removes transactions prior to and after the year provided.
263c263
<     if ($xctYear <= $delYear) {
---
>     if (($xctYear < $delYear) || ($xctYear > $delYear)) {
270c270,271
< 	  ($splAcntType eq "INCOME")) {
---
> 	  ($splAcntType eq "INCOME") ||
> 	  ($xctYear > $delYear)) {

--
John Carter



More information about the gnucash-user mailing list