Possible Duplicate:
How to convert a text file’s line termination from Windows/DOS to Unix
What's the best way to convert CRLF's to line feeds in files on Linux? I've seen sed commands but is there anything simpler?
|
1
|
What's the best way to convert CRLF's to line feeds in files on Linux? I've seen sed commands but is there anything simpler?
|
||||||||
|
closed as exact duplicate by nagul, Arjan van Bentem, Jeff Atwood♦ Oct 11 at 8:39 |
|
| This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. |
|
|
Use this command:
The other way around:
These commands are found in the tofrodos package (on most recent distributions), which also provides the two wrappers unix2dos and dos2unix that mimic the old unix tools of the same name. |
||||||||
|
|
|
Use |
||||||||||||||
|
|
|
I prefer perl:
But that's well-suited to my uses, and it's very easy for me to remember. Not all systems have a dos2unix command, but most that I work on have a perl interpreter. Another is recode, a powerful replacement for dos2unix and iconv; it's available in the "recode" package in Debian repositories:
For awk fans:
...and sed:
And now, only slightly-less-convoluted than deleting the CR's by hand in a hex editor, straight from one of our stackoverflow.com friends, useable with the beef interpreter (located on your friendly neighborhood Debian repository), dos2unix in brainfuck!
big thanks to jk for wasting an hour of his life to write this! |
||||||||||||||||
|
|
|
In vi or vim :%s/^V^M//g |
||
|
|
|
|
I do this on bash:
|
|||
|
|
|
I prefer vim and |
||
|
|
|
|
If you want a GUI method, try the KATE text editor (other advanced text editors may be able to handle this too). Open the find/Replace dialog (Ctrl+R), and replace EDIT: Or, if you simply want to convert to Unix format, then use the menu option |
||||
|
|
|
I think you can use
|
||
|
|