Listing 1. Common Tasks with tr

# (13) Transform lower case alphas to their 
#      equivelent upper case.
$ echo "Hello World." | tr "[a-z]" "[A-Z]"
HELLO WORLD.

# (14) Same lower to upper transformation - 
#      uses character class names :lower: 
#      and :upper:.  (tr recognizes 12
#      character class names).
$ tr "[:lower:]" "[:upper:]" README > UPPER_README

# (15) Make $PATH a bit more readable/searchable -
#  substitude ':' with a line feed
$ echo $PATH | tr ":" "\n"
/usr/bin
/bin
/usr/local/bin
.....
$ echo $PATH | tr ":" "\n" | grep -i "local"
/usr/local/bin
/usr/home/curly/Local_bin

# (16) Remove all white space from a file.
$ tr -d "[:space:]" < README > NO_WHITE_SPACE

# (17) Substitute all single or sequence of ; 
#      with a single :
$ echo ";;;;This;;is;a;;;;simple;;;example." \
| tr -s ";" ":"
:This:is:a:simple:example.