[Tfug] Bulk OpenOffice Conversion

Bill M. beelymagee at cox.net
Thu May 24 23:28:25 MST 2007


Jim,

> Date: Thu, 24 May 2007 07:45:32 -0700
> From: Jim Secan <jim at nwra.com>
> Subject: [Tfug] Bulk OpenOffice Conversion
> To: tfug at tfug.org
> Message-ID: <3.0.5.32.20070524074532.00e08048 at zelda.nwra-az.com>
> Content-Type: text/plain; charset="us-ascii"
> 
> 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 (customer is
> tied to MS products).  Far too many to use the GUI approach.  After some
> fruitless googling, I thought I'd ask if anyone has used, or know of, shell
> or python tools that can do this conversion from the command line.
> 
> TIA
> Jim
One word: awk or maybe sed. I just finished the Unix class at PCC with
our favorite geek and new father, Harry. I don't have my manual in front
of me, but something like this:

awk -f fix-data.awk tab-delim.txt

# take an input command file, output text file
# FS = field separator TAB, ORS = output record separator linefeed
BEGIN { OFS = "\t", ORS = "\n" }
# each option $1, $2 is the input field with the default input field
# separator is a space, you can specify others
{ print $1, $2, $3, $4 }

-*-Bill




More information about the tfug mailing list