Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

character ^M 3

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
Hi,
I've a very long file which each line has character ^M in end of line. I edit the file with vi. I need to clear those characters. How can I erase it?

Thanks
 
Do a search for dos2unix to find what you are looking for.

[morning] needcoffee
 
1,$s/<CTRL-V><ENTER>//g

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
in vi:

:1,$ s/.$//<enter>

but take care, this deletes every last character of every line, even if it isn't a ctrl-M char.

safer is:

:1,$ s/<ctrl-V><ctrl-M>$//<enter>

or use a dos2unix utility as needcoffee suggested.


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top