top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we change all uppercase characters to lowercase using vi, or any other technique may be easier?

+2 votes
324 views
Can we change all uppercase characters to lowercase using vi, or any other technique may be easier?
posted Sep 22, 2014 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
~    : Changes the case of current character
guu  : Change current line from upper to lower.
gUU  : Change current LINE from lower to upper.
guw  : Change to end of current WORD from upper to lower.
guaw : Change all of current WORD to lower.
gUw  : Change to end of current WORD from lower to upper.
gUaw : Change all of current WORD to upper.
g~~  : Invert case to entire line

1 Answer

+2 votes

For changing the case in vi follow below step:

  1. Open file and go to command mode.
  2. type :%s/.*/\L&/ and for change to upper case type :%s/.*/\U&/
  3. Save the file.
answer Sep 22, 2014 by Kali Mishra
Similar Questions
0 votes

I observe 2 different behaviors of vi that I cannot explain. 2 different machines, same distribution

On one machine when I underline some text with the mouse (not in append mode), vi turns to a VISUAL mode, and not in the other machine.

–1 vote

I have a large file which has "some string"so many times, i want it to be replaced with "other string" at all places, using vi or vim editor?
Is there any way to do that?

...