To remove the CRLF at the end of a line: :%s/^V^M//
^
CTRL-V-CTRL-M
To remove blanklines (LF): :%s/^$//
^
NOT CTRL-$, but just ^ and $
To remove blanklines containing ^M (CRLF): :%s/^^V^M$//
\Ruben.
--
Ove Ruben R Olsen, Professional VI user. EMAIL: Ove.R...@ubb.uib.no
Maintaining the Largest VI/EX-STUFF Archive in the WORLD (alf.uib.no) and
the Comp.Editors FAQ file. If you have information about editing, new editors,
please get in touch with me. This does not apply to EMACS type of editors.
Any ideas?
--
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\ Serge Stewart | ser...@x10siv.wariat.org \\
\\ -------------------------- | "Agony is born of Desire... \\
\\ Kansas City,Missouri 64130 | thats what you get for wanting" -Moev \\
If there are any CRs in the buffer (vi shows those as ^M), you can use
"x" to get rid of them.
The easiest way to get rid of an LF is usually "J" (join lines).
Vi tries to be smart about "J" and give you the appropriate amount
of white space instead. If you don't want that, you can "x" it out
or use ":j!" instead of "J" to stop vi from generating it.
--
Hope this helps,
Hans Mulder ha...@cs.kun.nl
Use: :%s/^V^M$//
just in case you have some strange file format (^M in middle...)
:To remove blanklines (LF): :%s/^$//
: ^
: NOT CTRL-$, but just ^ and $
Blank lines may have blanks and tabs, and they are not visible
unless you use :set list , so is better to use:
:%s/^[ ][ ]*$//
or
:%s/^[ ]+$//
Between square brackets there are a blank and a tab.
Bye, Lanfranco
--
Lanfranco Albani - CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia
Email: (work:) alb...@cadlab.sublink.org, (home:) b...@allan.sublink.org
Phone: (work:) ++39 (51) 6130360, (home:) ++39 (51) 727372;
Fax: ++39 (51) 6130294 (work only), Fidonet: 2:332/407.1138 (home only).