QFX import problem and work around, possible bug or new feature?

Chris Good chris.good at ozemail.com.au
Tue Sep 13 17:24:29 EDT 2016


> Message: 1
> Date: Mon, 12 Sep 2016 09:04:56 -0700
> From: Ed Reeder <ereeder at mailup.net>
> To: gnucash-user at gnucash.org
> Subject: Re: QFX import problem and work around, possible bug or new
> 	feature?
> Message-ID:
> 	<1473696296.3408818.723242841.2761EE3B at webmail.messagingengi
> ne.com>
> Content-Type: text/plain
> 
> Here is an awk script to solve one QFX import problem.  Hopefully this is
to
> the GnuCash mailing list, so that people can see it.  Evidently it was not
visible
> where I posted it.  (Thanks Derek for the heads up)
> 
> Hope this of use to someone.  I wrote a gawk script (awkqfx) that strips
out
> the <CATEGORY> and <MEMO>null lines.  This is for DOS, Windows 10.
> I changed the PATH variable to find both gawk and my CMD file.
> 
> ------------------------------------------------------------------------
> --------------------------------------
> @ECHO OFF REM DOS CMD file that removes <CATEGORY> and <MEMO>null
> lines from QFX files REM REM It's been twenty years since I wrote an awk
> program, wish I remembered how to put in a null REM action so that I
didn't
> have the {x += 1} statements :-) REM REM Example use: awkqfx <
> ORIGFILE.QFX > EDITEDFILE.QFX
> 
> gawk "{if ($1 ~ /.CATEGORY./) {x += 1} else if ($1 ~ /.MEMO.null/) {x +=
1}
> else print $0}"
> 

Hi Ed,

You can use 'next' instead of dummy 'x +=1' in this case.
I suggest:
awk '
  /^<CATEGORY>/ { next }
  /^<MEMO>null/ { next }
  { print }' < infile > outfile

Although as you're just deleting some lines I'd probably:
  egrep -v '^<CATEGORY>|^<MEMO>null' infile > outfile

Regards, Chris Good
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4817 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20160914/a11cda5b/attachment.p7s>


More information about the gnucash-user mailing list