dos2unix using sed – How to remove ^M chars from a DOS file

After dos2unix using vim, here is dos2unix using sed


in bash you could type the following command:

# sed 's/^M$//' input.txt > output.txt

or  you can convert UNIX to DOS by typing the following command:

# sed 's/$'"/`echo \\\r`/" input.txt > output.txt

 

 

 

 

 

If you found useful this article, please share it using the social buttons below. Thank you in advance,

Gg1.


Posted by at April 9, 2009
Filed in category: Bash Tip & Tricks, linux, and tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

Statistical data collected by Statpress SEOlution (blogcraft).