[Tfug] Bulk OpenOffice Conversion
Rich
r-lists at studiosprocket.com
Thu May 24 15:25:33 MST 2007
On May 24, 2007, at 7:45 am, Jim Secan wrote:
> I need to convert a large number of ASCII data files (column
> format, space
> delimited) to OO Calc format, and from there to Excel format
Hm. Forgive me if I'm missing something, but from the information you
give, it sounds a pretty simple conversion.
I don't think you mean that a single space is the delimiter, and the
columns aren't actually aligned:
cat file | sed -e 's/ /,/g' > file.csv
Okay, so columns *are* aligned. I'll assume ten characters per column:
cat file | sed -e 's/\(..........\)/\1,/g' > file.csv
Basically, after every ten characters, insert a comma in the eleventh-
of-ten position. Maybe pre-check for commas and replace them with a
placeholder character because escaping is going to mess with the
columns.
Alternatively, you could drum up something tasty with cut and awk.
Again, apologies if I'm assuming this is as trivial as I'm suggesting.
Rich.
More information about the tfug
mailing list