I need to change all lowercase letters e, s, t, and a to uppercase letters in a text file in vim. I tried using :%s/e/E/g for all letters but I couldn’t find a better solution. I want to do it using the command, not via visual method.
Advertisement
Answer
Try this using %s.Capture the pattern first; and then change the captured pattern to uppercase.:
& is whole captured pattern
U change to uppercase
:%s/[esta]/U&/g
If you are on linux system you can also use tr. ! denotes shell command.
:%!tr esta ESTA