LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-24-2003, 02:20 PM   #1
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
UPPERCASE to lowercase command?


Is there a bash command to convert a word that contains a couple of uppercase letters to an all lowercase letters word?

Like converting "TeSt" to "test"

Maybe 'sed' or 'tr' ???
 
Old 09-24-2003, 02:28 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
yep tr will do it fine, there are at least three examples of case converting in the info documentation for tr.

you could do it in sed but not easily.
 
Old 09-24-2003, 02:31 PM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Did you do man tr at all?????

$ echo "TesT" | tr [:upper:] [:lower:]
test

Or using sed

$echo "TesT" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
TEST
 
Old 09-24-2003, 02:34 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
You can use awk. Just pipe your string into:
awk {'print tolower($_)'}

eg:
echo TeSt | awk {'print tolower($_)'}
 
Old 06-12-2007, 11:26 AM   #5
pujansrt
LQ Newbie
 
Registered: Jun 2006
Posts: 22
Blog Entries: 1

Rep: Reputation: 15
linux@linux:~> echo TeSt |sed 's/\(.*\)/\L\1/'
test
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
samba replaces Uppercase char in filenames to lowercase srikz Other *NIX 3 03-03-2006 09:59 AM
Converting Uppercase to Lowercase AMMullan Linux - Software 6 10-18-2005 08:32 PM
samba replaces Uppercase char in filenames to lowercase srikz Red Hat 1 10-26-2004 04:47 AM
External harddrive FAT32- VFAT options (uppercase to lowercase file name translation) pauquetb Linux - General 1 03-20-2004 01:52 PM
Converting lowercase to uppercase noodle123 Programming 1 05-17-2002 03:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:19 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration