How to strip DOS line endings using vim

In vim's command mode, type:

:%s/^M$//

(To get ^M, press ^V^M, where ^ is Ctrl on most keyboards). In order to avoid the ^V^M hassle you can also type (saves two characters):

:%s/\r$

Christodoulos Fragoudakis
 chfrag AT gmail.com
  chfrag AT central.ntua.gr
       
Infinite loops around computer science, programming, system administration and teaching.