how to edit ofx file with sed editor? Replace Copy FITID

LinforPros linforpros at
Mon Oct 3 19:59:35 EDT 2016

Hi Chris,
Here is what I mean:

$ diff -s september2016.ofx september2016converted.ofx 
Files september2016.ofx and september2016converted.ofx are identical

The above file september2016converted.ofx has been generated with:

$awk -f awkconvert_gwb.awk september2016.ofx > september2016converted.ofx

The script that I used looks like the following:
$ cat awkconvert_gwb.awk 

/^<STMTTRN>/ {
/^<FITID>/ {
	idx=index($0, "**")
	if (idx > 0) {
		name=substr($0, idx+2)
/^<NAME>/ {
	if (length(name) > 0) {
		print "<NAME>" name
{ print }

So in essence the lines FITID and NAME did not change after running the
script. If they did the files would differ and NAME would contain only the
characters after the double "**" that occur in the FITID without truncation
of the row.

For instance the following line ends with "MINNESOTA A"
<FITID>20160902000000[-6:CST]*-27.68*13**POS DEB 2022 09/01/16 00077336 KUM 
GO #0633 1400 N MINNESOTA A

but NAME (as supllied by the bank) is different:
<NAME>POS DEB 2022 09/01/16 00077336 K

After the awk script gets applied the NAME should look like this:
<NAME>POS DEB 2022 09/01/16 00077336 KUM  GO #0633 1400 N MINNESOTA A

...also ending with "MINNESOTA A"

As referred to awk's -D option I meant this:
$ awk -V
GNU Awk 4.1.3, API: 1.1
$ awk --help |grep '\-D'
-D[file]		--debug[=file]

Any hints will be welcome

View this message in context:
Sent from the GnuCash - User mailing list archive at

More information about the gnucash-user mailing list