Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to represent a new line character in a regex in VI?

Status
Not open for further replies.

Spab23

Programmer
Jul 22, 2003
43
CA
Hey there VI gurus,

I want to globally replace all tilda characters with a new line character in a file I am working on.

I've tried [tt]:%s/\~/\n/g[/tt] but all that does is replace the tildas with the letter n.

How can I represent a newline character in this replacement statement?
 
To add a newline character using VI regex
Code:
:%s/\~/[b]^M[/b]/
ATTN: To achieve the newline ^M you must do CTRL-V [ENTER]

M. Brooks
 
That worked like a charm, mbrooks. (resisting the urge to call you "Mel"!)

Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top