Home > Bash Tip & Tricks, linux > dos2unix using sed – How to remove ^M chars from a DOS file

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.


Categories: Bash Tip & Tricks, linux Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.
*

Statistical data collected by Statpress SEOlution (blogcraft).