The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
only uppercase first character? fedora Shell Programming and Scripting 7 09-26-2008 08:12 PM
Need to change filenames in a particular directory from lowercase to UPPERCASE Duke_Lukem UNIX for Dummies Questions & Answers 7 01-07-2008 06:32 PM
How convert lowercase or uppercase Alex20 Shell Programming and Scripting 5 03-07-2005 07:07 AM
Converting to Uppercase dreams5617 Shell Programming and Scripting 3 11-12-2004 01:44 AM
uppercase to lowercase webex Shell Programming and Scripting 4 01-03-2002 02:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-11-2007
ggovotsis ggovotsis is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 3
Lowercase to Uppercase

Inside a script I have 2 variables COMP=cy and PT=t. further down the same script I require at the same line to call those 2 variables the first time uppercase and after lowercase ${COMP}${PT}ACE,${COMP}${PT}ace. Can somebody help me

Thanks in advance

George Govotsis
  #2 (permalink)  
Old 12-11-2007
gus2000 gus2000 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 157
There are a variety of ways to do what you suggest. The simplest is to create variables that the shell will convert to all uppercase or lowercase:

Code:
typeset -u COMP_UPPER PT_UPPER
typeset -l COMP_LOWER PT_LOWER
The variables above will always convert their values to uppercase or lowercase, respectively. Of course, you can also convert via other programs:

Code:
echo "$COMP" | tr '[a-z]' '[A-Z]'
echo "$COMP" | awk '{print toupper($0)}'
You get the idea.
  #3 (permalink)  
Old 12-11-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
Quote:
Originally Posted by gus2000 View Post
There are a variety of ways to do what you suggest. The simplest is to create variables that the shell will convert to all uppercase or lowercase:

Code:
typeset -u COMP_UPPER PT_UPPER
typeset -l COMP_LOWER PT_LOWER
The variables above will always convert their values to uppercase or lowercase, respectively. Of course, you can also convert via other programs:

Code:
echo "$COMP" | tr '[a-z]' '[A-Z]'
echo "$COMP" | awk '{print toupper($0)}'
You get the idea.
I guess the OP wanted the variable values to be capitalized - not the whole string to be UPPER-cased.
The OP will have to clarify!
  #4 (permalink)  
Old 12-11-2007
SebaM6 SebaM6 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 34
I guess you can also use syntax as
Code:
print $VARIABLE|sed 'y/[a-z]/[A-Z]'
  #5 (permalink)  
Old 12-13-2007
funksen funksen is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 430
or

tr "[:lower:]" "[:upper:]"

tr "[:upper:]" "[:lower:]"
  #6 (permalink)  
Old 10-16-2008
ajit.yadav83 ajit.yadav83 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 13
i dont have any variable
i dont have any file

i just want to convert AJIT to ajit
can i do this in UNIX atraight away
  #7 (permalink)  
Old 12-11-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
Code:
#!/bin/ksh

a='foo'
typeset -uL1 b=${a}
echo "${b}${a#?}"
More on this here.

Last edited by vgersh99; 12-11-2007 at 04:07 PM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0