Wednesday, November 25, 2009

changing case within vi

1)
If you have to change one or two letters, use ~ over the letters while in command mode. vi toggles the cases with ~

2) Between a range, say marks a and b

Change to lower case
'b,'a,s/[aA-zZ]/\L&/g

Change to upper case
'b,'a,s/[aA-zZ]/\U&/g

3) Change to upper case thru out the file
%s/[aA-zZ]/\U&/g

No comments:

Post a Comment