Home
There Are 10 Types of People in the World....

Tags in Blog

CentOS Devel Fedora Fun General GNU/Linux MySQL PHP Private Life Python Samba Tips and tricks
more tags














Home

Tip: vi and lowercase/uppercase

Submitted by lefred on Thu, 01/10/2008 - 13:32

As always I use my blog as reminder of some useful commands or tips.

This one is for dimi, to change the case of a full document in vi, use the following command to transform everything in lowercase :


<ESC>:%s/.*/\L&/

and in uppercase :

<ESC>:%s/.*/\U&/

I hope this helps ;)

  • Add new comment
Tags:
  • GNU/Linux
  • Tips and tricks

6 reponses to "Tip: vi and lowercase/uppercase"

Anonymous's picture

1. Help! Need driver for phillips wireless pcmcia card.

Submitted by advexiatred (not verified) on Wed, 04/08/2009 - 15:32.

I need a driver for my phillips snn6500 wireless netcard
or smc2632 wireless net card.
I can`t make them run on linpus linux lite.

Please help.

Regards,
VadeDromaro

  • reply
Anonymous's picture

2. might be easier...

Submitted by Anonymous on Mon, 01/14/2008 - 15:47.

for uppercase: gggUG
for lowercase: ggguG

PS: the first 2 g's are for moving to the beginning of the document.
PS2: works in vim, don't know about plain vi

  • reply
Anonymous's picture

3. Anonymous is right!

Submitted by Anonymous (not verified) on Wed, 01/14/2009 - 18:09.

so just wanted to break down that last post so people know what's up with it.

the first 2 'g's put your cursor to the beginning of the file. the 3rd g puts you in what appears to be a "replace" mode of some kind. U means uppercase (or u means lowercase) the final G means until the end of the file.

So if you want to manipulate just a single word you should move the cursor to the beginning of the word then type gUw ((g)replace to (U)uppercase until (w)the end of the word).

Or if you want to go from the current position to the end of the line gU$ ((g)replace to (U)uppercase until ($)the end of the line).

Or if you want to go from the current position to the next 'x' on the line gUtx ((g) replace to (U) uppercase (t) to (x) the x character)... Of course you can replace x with any character you want.

Figured that might help those who don't know about jumping around in a file.

(also if you only want to do the current line and the next two lines: gU2).

This stuff is handy!

  • reply
Anonymous's picture

4. that last one in brackets there...

Submitted by Anonymous (not verified) on Wed, 01/14/2009 - 18:11.

was supposed to be gU2<down arrow>

  • reply
Anonymous's picture

5. the 3rd "g"

Submitted by Liz (not verified) on Wed, 01/21/2009 - 22:58.

You can think of the third "g" as "global"... as in "apply this to the whole file".

  • reply
Anonymous's picture

6. Very clear

Submitted by udaman (not verified) on Tue, 03/16/2010 - 17:03.

I didn't know what the 3rd g meant. Now I know. Thanks!

  • reply

twitter updates

    Recent comments

    • fedora on mac osx
      1 week 6 days ago
    • Fresh install fc13
      1 week 6 days ago
    • Everything is a Freaking ...
      2 weeks 3 days ago
    • x32
      4 weeks 6 days ago
    • There is no x32 download url
      4 weeks 6 days ago
    • Help me
      5 weeks 5 hours ago
    • binlogs
      6 weeks 5 days ago
    • Replication Master to multi-Master, possible ?
      6 weeks 6 days ago
    • Download
      13 weeks 5 days ago
    • I've read this morning on
      16 weeks 1 day ago

    Locations of visitors to this page

    Fervens Drupal theme by Leow Kah Thong. Designed by Design Disease and brought to you by Smashing Magazine. Modified for my own use.