csv format files

Jean-Pierre A. Radley appl at jpr.com
Thu Feb 12 15:58:40 PST 2009


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


More information about the Filepro-list mailing list