Wednesday, January 9, 2008
lowercase UPPERCASE Titlecase - 'vi' way of doing
The Ultimate VI Helpline is here: http://www.vmunix.com/~gabor/vi.html
We have commands like "tr", tools like "sed", strong one liners from perl to do the conversions of lowercase UPPERCASE Titlecase . "vi" too provides the same, some of its :ex commands are below.
:1,$ s/.*/\L&/ #Make whole file contents lowercase
:1,$ s/.*/\U&/ #Make whole file contents uppercase
:1,$ s/\<./\u&/g #Make first letter of all words uppercase
:1,$ s/\<./\u&/gc #Make first letter of all words uppercase with confirmation, this will go to all words even
though the first letter is UPPERCASE
:1,$ s/\<[a-z]/\u&/gc #Same as above, but this will go to all words with a lowercase first lettter.
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
1 comment:
Kudos !!! This is really nice and useful. Thanks buddy, your posts are really practical and of day-to-day use.
Post a Comment