Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove Carriage Return

Status
Not open for further replies.

plook

IS-IT--Management
Apr 1, 2000
33
Good Afternoon,

Does anybody know how we can remove all the Carriage Return codes (ASCII CODE 13) and leave only the Line feeds (ASCII CODE 10) ?

What I need to do is to be able to send a text file made in windows to a linux box. But the linux box needs to be without any CR. I need some way to screen the files automatically and remove all the CR in it. Or a way to save a file in Windows without CR, but only LF in it.

Any ideas how to proceed?

Dominic
 
On a unix system, you can remove the carriage return characters using 'tr'. For example:

cat <filename> | tr -d '\r' > <filename>

If the file is large enough, you'll need to output to a different file or you won't end up with the whole thing at the end.
 
Thanks GoldenEternity !

it seems to be working perfectly !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top