UNIX command to reverese lower and upper case

im trying to find a command to
change all upper case to lower case and
all lower case to upper case.
for example:
file is 'RED sox'
need it changed to 'red SOX'

tried tr 'a-zA-Z' 'A-Za-z' didn't work

what an i missing??

thanx for the help

I tried

tr "a-zA-Z" "A-Za-z"

and that worked on Etch.

I would expect it to work with single quotes as well:

$ echo RED sox | tr 'a-zA-Z' 'A-Za-z'
red SOX
$

rfourn, what version of Unix are you using? And what shell?

The pre-posix USG based version of tr used to require brackets around a range. On such a version,
tr '[a-z]' '[A-Z]'
would work for sure. I don't remember for sure if multiple ranges would work, but I think they did. If so,
tr '[a-z][A-Z]' '[A-Z][a-z]'
would work. BSD never required the brackets and Posix adopted the BSD style for ranges. Legacy USG scripts will tend to work with a Posix version of tr because with
tr '[a-z]' '[A-Z]'
brackets are being replaced by themselves. A legacy USG scrip with code like:
tr 'a-z'
where the 'a-z' is supposed to be exactly 3 characters will fail though.

I hope you aren't using a very old version of Unix with behavior like this. But if you are, it is especially crucial that you mention your Unix version with every question.

Hi version of UNIX is SOLARIS 9

but neither of the aforesaid commands is working..

Will you suggest how to execute the same in SOLARIS9?

echo RED sox | tr '[:upper:][:lower:]' '[:lower:][:upper:]'
red SOX

Works for me on HP-UX, Solaris, and Cygwin on Windoze.

# uname -a
SunOS mysun 5.10 Generic_118833-17 sun4v sparc SUNW,Sun-Fire-T200# echo RED sox | tr 'a-zA-Z' 'A-Za-z'
RED sox

# uname -a
HP-UX myhp B.11.11 U 9000/800 158454601 unlimited-user license
# echo RED sox | tr 'a-zA-Z' 'A-Za-z'
red SOX

$ uname -a
CYGWIN_NT-5.0 mypc 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
$ echo RED sox | tr 'a-zA-Z' 'A-Za-z'
red SOX

echo RED sox | tr '[:upper:][:lower:]' '[:lower:][:upper:]'
red SOX

This is perfectly working in my Solaris OS

SunOS XXXXXXX 5.10 Generic_118833-24 sun4u sparc SUNW,Netra-T12