[Techtalk] script to change uppercase to title case in OFX/QFX
Miriam English
mim at miriam-english.org
Wed Nov 30 01:09:29 UTC 2011
Huh... noticed an even simpler solution if you want to relax the
requirements a little:
sed 's/\( *[A-Z]* *\)/\L\u\1/g'
This one just looks for words and does the deed to them. Be wary though.
It could have unintended side-effects, for instance I think it might
translate the letters in 1234ABC into 1234Abc
Cheers,
- Miriam
Carla Schroder wrote:
> It is MUCH too quiet here. So here is a little problem for you fine brainiacs.
> I import OFX/QFX files from my bank accounts into GnuCash, a nice time saver.
> BUT. It is all uppercase, so it's like GnuCash is shouting at me, which makes
> me sad. I've been trying to figure out a nice one-liner or script to convert
> selected fields to title case, and so far have failed utterly. QFX is Quicken's
> proprietary "enhancement" to the open OFX format; it includes some secret
> magic somewhere to force institutions to pay royalties. Nice, eh? But I
> digress. Both are a form of SGML, and this is what it looks like:
>
> <STMTTRN>
> <TRNTYPE>DEBIT
> <DTPOSTED>20111125000000[-5:EST]
> <TRNAMT>-22.71
> <FITID>****
>
> <NAME>CHESTERS THRIFTWAY JOHN
> <MEMO>CHESTERS THRIFTWAY JOHN DAY OR 11-25-11 330346
> </STMTTRN>
>
> <STMTTRN><TRNTYPE>DEBIT
> <DTPOSTED>20111125000000[-5:EST]
> <TRNAMT>-4.56
> <FITID>***
>
> <NAME>USPS 4058720860963919 MOUNT
> <MEMO>USPS 4058720860963919 MOUNT VERNON OR 11-24-11 910453
> </STMTTRN>
>
>
> I want the NAME and MEMO fields in title case. The tags need to be in
> uppercase; I don't know if this part of the spec or a limitation in GnuCash.
> Is this too much to ask? So much happiness it would bring. I have tried
> various things myself and not figured out the magic that selects only the NAME
> and MEMO data without changing tags or other data fields.
>
> thanks :)
>
> Carla
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Carla Schroder, ace Linux guru and howto author
> 541-932-4817 PT
> carla at tuxcomputing.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
>
>
--
If you don't have any failures then you're not trying hard enough.
- Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
-----
Website: http://miriam-english.org
Blogs: http://miriam-e.dreamwidth.org
http://miriam-e.livejournal.com
More information about the Techtalk
mailing list