Kill CTRL-M's From a Windows File

Because so randomly do I need this, in vi, to delete all instances of a CTRL-M at the end of a line, do this command:

:%s/^M//g

to make the ^M, do a CTRL-V, CTRL-M.

Good times.

Advertisements

Author: Kevan

Director, Technology at Capital One Labs. Married to Erin, with two sons, Cooper and Fletcher. We live in Arlington, VA, USA.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s