1834250 Members
1877 Online
110066 Solutions
New Discussion

sed help

 
SOLVED
Go to solution
Sandeep_12
Occasional Advisor

sed help

Hi How do I remove ^M from all the lines in a file using sed.

Thanks for the help

Sandeep
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: sed help

Instead of using sed for this, have a look at the us2dos and dos2ux commands.
Sridhar Bhaskarla
Honored Contributor

Re: sed help

Hi Sandeep,

Use sed 's/^M//g' file > file1

Or in vi use

:%s/^M//g'

^M = ctrl-v ctrl-M together

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sandeep_12
Occasional Advisor

Re: sed help

ok..I want's to remove ^M only in the end of each line please...
Sridhar Bhaskarla
Honored Contributor

Re: sed help

Only end of the line

sed 's/^M$//g' file > file1

-Sri
You may be disappointed if you fail, but you are doomed if you don't try