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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vi question on uppercase translation 3

Status
Not open for further replies.

SirCharles

Programmer
Jun 10, 2002
212
US
How do you translate characters to upper-case in vi?
 
The tilde (~) switches the case of the character under the cursor.
 
Or to uppercase a large number of lines from, say, the current line to the end of the file, use

.,$s/.*/\U&/

or all lines in the file

%s/.*/\U&/


CaKiwi

"I love mankind, it's people I can't stand" - Linus Van Pelt
 
Thanks guys. Great response.
To just capitalize one word, it looks like this works:
.s/[^ ]* /\U&/
 
or, slightly simpler

s/[^ ]*/\U&/

CaKiwi

"I love mankind, it's people I can't stand" - Linus Van Pelt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top