Skip to content

Instantly share code, notes, and snippets.

@StephaneTrebel
Last active March 24, 2025 09:12
Show Gist options
  • Save StephaneTrebel/275d3353427bb1fcea56d1075a3cb287 to your computer and use it in GitHub Desktop.
Save StephaneTrebel/275d3353427bb1fcea56d1075a3cb287 to your computer and use it in GitHub Desktop.
Easily delete blocks from an OFX file
#!/bin/bash
# I always have issues with parsing LEDGERBAL and AVAILBAL in OFX files
# So I use this simple loop (that could be even further simplified with a `find`)
# To remove these two blocks, since I don't actually use them.
# One convenient thing is that these two blocks are contiguous so I only need
# To have a regex for the start of the first one (LEDGERBAL) to the end
# of the second one (AVAILBAL)
for file in $(ls input/*.ofx);
do
sed -i '/LEDGERBAL/,/\/AVAILBAL/d' $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment