vim command to remove extraneous characters?

Viewed 98

I used to know a vim command sequence where I would remove all the non-printable extraneous characters in a file, like ^M on Windows files that ended up with col -xb, but I can't recall the keyboard sequence before I enter the col -xb command to say "do this from top-to-bottom of file." Does this ring a bell to anybody?

2 Answers
:%!col -xb

: enters the ex-command mode as usual,% selects all lines (you can also write other ranges, like 100,150 for lines 100 to 150) and ! pipes them through an external command.

Related