csv format files

Bruce Easton bruce at stn.com
Fri Feb 13 06:20:29 PST 2009


Jean-Pierre A. Radley wrote Thursday, February 12, 2009 6:59 PM

Bruce Easton propounded (on Thu, Feb 12, 2009 at 06:08:03PM -0500):
| I'm working with a filepro-based program that produces csv files on Unix.
| The file will ultimately gets used by someone's SQL Windows-based app 
| (unknown).  On Unix, when I use the xtod command, the file I wind up 
| with has a Ctrl-Z at the end (all by itself on the last line).  My 
| Excel opens the resulting file up fine, but the client's SQL issues an
error (??).
| 
| I do notice that if I save an Excel spreadsheet in MS-DOS csv format, 
| transfer binary to Unix and then look at it - it does not have the 
| Ctrl-Z at the end, so I guess my question is - is the Ctrl-Z normal 
| for the xtod program or do I have a bad xtod?
| 
| (I'm assuming that in any case I will be able to tr or sed out the 
| Ctrl-Z if need be.)

So don't use xtod.  Use my cr+- script instead.

	#!/bin/sh
	#@(#)cr+-   JPRadley v 1.1
	#@(#)adds CRs if not present, strips them if present
	#@(#)if you just cat this file, you miss its essence, so instead
	#@(#)cat -v this file so as to see two actual ^M that it contains
	sed '
	s-^M--g
	t
	s+$+^M+
	t
	'
--
JP
_______________________________________________

Thanks much, JP and others who responded. I failed to
read the man page on xtod completely the first time, 
just noticing that there are options that can be used. 
Now that I read it again, I see that it describes 
exactly what the command does.

Bruce

Bruce Easton
STN, Inc.
 



More information about the Filepro-list mailing list