sed command for replacing ctrl M char in a file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sed command for replacing ctrl M char in a file

vimal
Hi

I have a requirement to replace ctrl+M char in a file. I tried sed command like this.
sed -e "s/^M//" TI.txt > HY.txt . This worked fine for me two days ago. Now I am trying the same for a new file, but not working(it is giving HY.txt as 0 bytes , empty file).  Then I tried the same for the previous file that worked perfect, that also failing now.


I don't know , am I missing some thing.

FYI: I am not a unix/linux developer. I am oracle developer , knows some of the Unix commands to help me in my work.



If any idea or tips for removing ctrl M char , please share it here. It is an urgent requirement.

Thanks,
Vimal...
Reply | Threaded
Open this post in threaded view
|

Re: sed command for replacing ctrl M char in a file

Guru
Administrator
Hi
 The only thing I can think of is the way you fed the character '^M' in the command prompt. Check this link to know how to do that:

http://www.theunixschool.com/2011/03/different-ways-to-delete-m-character-in.html

Guru