The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-26-2008
tekster757 tekster757 is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 33
Change date to uppercase

Hello,

I'm trying to take a 3 character date and change it to uppercase, does anyone know how to do that?

Currently, all commands that I know of for changing strings/variables to uppercase change the command itself to uppercase, not the output.

Here is what I've tried:

date="date +%b"
echo $date
Aug

echo $date | tr "a-z" "A-Z"
DATE +%B
echo "$date" | tr '[a-z]' '[A-Z]'
DATE +%B

OR:
DATE=`echo $date|awk '{print toupper($0)}'`
$DATE
ksh: DATE: not found

OR:
print $date|sed 'y/[a-z]/[A-Z]'
sed: Function y/[a-z]/[A-Z] cannot be parsed.

Does anyone know how to get that date to all CAPS? (as you see above, it currently reads "Aug"...)