[PLUG] To the VI Question

Cooper Stevenson cooper at linux-enterprise.net
Mon Jul 15 20:33:30 UTC 2002


> I'm guessing that your original text file doesn't terminate with lines
> with newline, but rather (DOS-style) carriage return+linefeeds.

[snip]

If this is the case you will see a `^M' after every line when viewing
the file on the Unix box. Here's how to get rid of them in one swoop in
vi (read sentence after this command for details):

  :1,$ s/^M//

There's a trick to entering this. the ':1,$ s/' part is entered normaly.
When you get to the ^M part, instead of entering it as it looks, execute
a Ctrl-v-m. That is, hold down the control key and hit the `v' and `m'
keys consecutively.

The `Ctrl-v' part says, ``Get ready... I'm about to send you a Control
character.'' The `m' key, then, is said character. Do not release the
Ctrl key during this sequence.

The rest of the command (//) is typed normally.



-- 
______________________________________________________
Cooper Stevenson        |cooper at metasource.us
UNIX/Linux Consultant   |PH: (541)791-1322
MetaSource Technologies |www.metasource.us
------------------------------------------------------





More information about the PLUG mailing list