The Geek Blog

View Original

Convert to Uppercase or Lowercase in vi

The other day I have copied a load of statements (SQL) that I was putting into a script.  I have some strange OCD weirdness and like all the SQL scripts to be formatted a certain way, keywords in UPPERCASE things like that.

Now for all the index rebuilds the majority of the line should be upper case like

See this content in the original post

All the lines where all lower case, I could of used several different statements to make the words go uppercase, but I decided to just make those certain lines all uppercase.  To this this use the commands below, in this example everything from line 21 to 28 will be converted into uppercase.

See this content in the original post

You can if you want to change everything into Upper case, to do that

See this content in the original post

If you want to convert everything to lowercase then all you need to do is change the U for an L.

See this content in the original post