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 > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Lowercase to Uppercase ggovotsis AIX 7 10-16-2008 10:07 AM
only uppercase first character? fedora Shell Programming and Scripting 7 09-26-2008 08:12 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 Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-28-2007
kirkm76 kirkm76 is offline
Registered User
  
 

Join Date: May 2007
Posts: 9
make uppercase

If in a script I am taking an input (R201) for example and assigning it to a variable, how would I change the R to uppercase if it was keyed in as r201? I can't seem to get it to work with toupper
  #2 (permalink)  
Old 05-28-2007
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Using typeset

Krikm,
You can use the typeset options.The following script is an attempt to solve the problem.

Code:
#!/bin/ksh
typeset -u input
echo "Please Enter the input value:\c"
read input
echo "You Entered : $input"
Thanks
Nagarajan Ganesan.
  #3 (permalink)  
Old 05-28-2007
kirkm76 kirkm76 is offline
Registered User
  
 

Join Date: May 2007
Posts: 9
Thanks

That works like a charm...I had never seen that before.
  #4 (permalink)  
Old 05-28-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,513
Code:
# var=r201
# new=$(echo $var|awk -F "" 'BEGIN{OFS=""}{ $1=toupper($1)}1')
# echo $new
R201
  #5 (permalink)  
Old 05-28-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
the other option would be to use the tr command

Code:
$ echo r201 | tr '[a-z]' '[A-Z]'
R201
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:03 AM.


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