LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-08-2008, 02:52 PM   #1
ufmale
Member
 
Registered: Feb 2007
Posts: 386

Rep: Reputation: 30
Change all uppercase to lowercase with vi??


Can we change all uppercase characters to lowercase using vi, or any other technique may be easier?
 
Old 04-08-2008, 02:59 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
I'm using Vim, not Vi so you never know. But, guu will change all uppercase in a line to lower case. gUU goes the other way.

More commands here --> http://cross-lfs.org/~arowland/docs/vimtips.pdf
 
Old 04-08-2008, 03:16 PM   #3
prad77
Member
 
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
tr '[:upper:]' '[:lower:]' <file >newfile

Gentoo

Last edited by prad77; 04-17-2008 at 03:45 AM.
 
Old 05-06-2009, 03:32 PM   #4
Irenaeous
LQ Newbie
 
Registered: May 2009
Posts: 1

Rep: Reputation: 1
Change all uppercase to lowercase with vi?

Easy:

:%s/.*/\L&/

Conversely, :%s/.*/\U&/ will change all the characters to uppercase.
 
1 members found this post helpful.
Old 07-05-2013, 04:16 AM   #5
naga9711
LQ Newbie
 
Registered: Jul 2013
Posts: 1

Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by Irenaeous View Post
Easy:

:%s/.*/\L&/

Conversely, :%s/.*/\U&/ will change all the characters to uppercase.
Thanks-- This worked
 
Old 10-18-2017, 11:51 AM   #6
mralphawolf
LQ Newbie
 
Registered: Oct 2017
Posts: 1

Rep: Reputation: Disabled
Change upper/lower case at same time

Hello, silly question, how can these be combined so you change all upper case to lower case and all lower case to upper case at the same time, in the same text document.
 
Old 10-18-2017, 02:57 PM   #7
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
I don't know of one.
I wrote a program many years ago to correctly format names and addresses. It was written in Pl/1 and ran under Windows 3.1 and higher. Though the highest version I tested it with was Vista.
I see no reason why it wouldn't work under the latest Windows if the right libraries were available.
It was also compiled and run on IBM mainframes.
 
Old 10-18-2017, 03:04 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Using a C++ type language I'd or the characters with the relevant mask. Sorry, don't recall what it is but I do recall there's a mask you can or tochange case or xor to change to uppercase.
This was the first google result that looks familiar.
 
Old 10-18-2017, 07:38 PM   #9
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,761

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
The ~ key toggles the case of the current character and steps to the next character.
To change a thousand characters, hit ~ a thousand times, or type
Code:
1000~
 
Old 10-18-2017, 09:00 PM   #10
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,141

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Smile

Quote:
Originally Posted by MadeInGermany View Post
The ~ key toggles the case of the current character and steps to the next character.
To change a thousand characters, hit ~ a thousand times, or type
Code:
1000~
What would be the correct syntax to input that command against a text file?
 
Old 10-19-2017, 05:38 AM   #11
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,761

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
Just seeing that ~ does not advance to the next line
 
Old 10-19-2017, 06:16 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,630

Rep: Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265Reputation: 7265
go to the beginning of the file and
Code:
1000g~~
 
Old 08-06-2018, 06:00 PM   #13
jerryjquintana
LQ Newbie
 
Registered: Jul 2012
Posts: 1

Rep: Reputation: Disabled
Translate vi contents from UPPER to lower case

:%!tr [A-Z] [a-z]
 
Old 08-07-2018, 05:25 AM   #14
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,761

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
vim (not vi) support the following key sequences
Code:
gUw  change the current word to uppercase
gU$  change the current line to uppercase
guw  change the current word to lowercase
gu$  change the current line to lowercase
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UPPERCASE to lowercase command? pk21 Linux - General 4 06-12-2007 10:26 AM
Lowercase to Uppercase stellafrank Linux - Software 2 11-16-2006 05:46 AM
rename script won't change uppercase to lowercase on fat32 pwc101 Programming 4 09-27-2006 05:16 PM
Converting Uppercase to Lowercase AMMullan Linux - Software 6 10-18-2005 07:32 PM
Converting lowercase to uppercase noodle123 Programming 1 05-17-2002 02:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration