I import a comma separated list from my bank and open it in OOcalc. I
have trouble reading the date in their format of YYYYMMDDhhmmss, it's
all glommed together. I want to run a script on it before importing
that will put some character (prefer either "_" or " " as shown below.
DEBIT,20100208120000[0:GMT], \
DEBIT,20100208120000[0:GMT], \
DEBIT,20100204120000[0:GMT], \
DEBIT,20100125120000[0:GMT], \
DEBIT,20100125120000[0:GMT], / rest of lines trimmed
DEBIT,20100122120000[0:GMT], /
CREDIT,20100120120000[0:GMT], /
CHECK,20100119120000[0:GMT], /
^ ^
date field (YYYYMMDDhhmmss)
DEBIT,2010_02_08_120000[0:GMT], <<<<< end result I want
pass 6 or 7 char then find ","
then 4 digits for year
insert "_"
then 2 digits for month
insert "_"
then 2 digits for day
insert "_"
get rest of line
Tried combinations of sed & awk but haven't been able to insert the "_"
between the year, month, day, and time fields.
Pointers and suggestion would be greatly appreciated. I'm in the
process of learning bash scripting so please include how the script
works (what it does). I'm an old hand at C and assembler but the
bash/sed/awk syntax has me baffled.
--
Thanks, Tom (retired penguin)
openSuSE 11.3-M3, kde 4.4.0
FF 3.6.0