By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,062 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,062 IT Pros & Developers. It's quick & easy.

Carriage return at the end of the text line.

P: 1
Thanks in advance who will look at it.

I have been encountering an issue which I canít find a way out of it.

What my pgm does:

It (java codes) reads oracle table data and creates flat text data files. Another part of the program distributes the extracted text files to unix systems.

Problem first occurred:
Opening those files in Unix box shows carriage return in the middle of the record as well as at the end of the record.

My tries:

To strip out the CR or LF from the middle of the record added a check in program like looking for \r or \n and replace with ' '. That worked fine. But what happens is, depending on the data loading in the database, although the data looks identical across the databases, I encounter CR/LFs. so to clean it forcefully I modified the table views.
For example... (Text_field,chr(13)||chr(10),' ').

Okay that helped me getting rid of the in field CR/LFs... but the thing at the end of the line... ^M in Unix, which is the carriage return still showing up.

Not finding a way to eliminate that.

It probably is happening because of the file transfer from windows to unix. I also tried transferring the files manually using FTP program and in ASCII mode and still seeing those. The weird part it, some files shows up with CRs at the end some donít. Thatís where I am puzzled.

Just looking for way to clean it like... ďu know what...I donít want any carriage return anywhere... remove!!!Ē... possible?

I know a line separator or line breaker can come at the end otherwise it canít recognize the start of a new record but still why some files do have ^M and some donít?
Oct 4 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 145
In unix the command to remove ^M is dos2unix <filename>.

Hope that helps!!!
Oct 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.