LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (http://www.linuxquestions.org/questions/general-10/)
-   -   A one-liner to get rid of carriage returns (\r) in a text file? (http://www.linuxquestions.org/questions/general-10/a-one-liner-to-get-rid-of-carriage-returns-%5Cr-in-a-text-file-4175455484/)

stf92 03-25-2013 06:58 AM

A one-liner to get rid of carriage returns (\r) in a text file?
 
The file has only one (very long) line, an inheritance from the HTML where it came from.

stf92 03-25-2013 09:09 AM

Problem solved. I edited with vim and ':s/\r//g'. Voila.

propofol 03-27-2013 02:19 AM

Or this:

Code:

tr -d '\r' < oldfile > newfile

stf92 03-28-2013 04:41 AM

True! I used tr all the time when posting, to eliminate newlines after editing with vim.

jschiwal 03-28-2013 05:53 AM

There is also a handy dos2unix command.

John VV 03-28-2013 01:33 PM

"dos2unix" and "unix2dos" comes in [v] VERY[/b] handy when going between MS windows and linux

however most editors like gedit and kate do this
and on the windows side SciTe dose this

Quote:

The file has only one (very long) line, an inheritance from the HTML where it came from.
did you use windows "notepad" for this ?


All times are GMT -5. The time now is 10:25 AM.