The tr Operator

Introduction

The translates operator is the hardest of the three to use. It does character by character translation from a search list to a replace list . I would like to thank Jim Allenspach, jima@Mcs.Net, for his help in clearing up problems in implementing this page.

Trial and Error in Pursuit of tr Understanding

To start, here is a "simple" example:
searched stringsearch listreplace listExplanation
How are you?HowWhereH->W, o->h, w->e

If you turn on the complement flag with the same input, only those NOT in the search list are replaced.
searched stringsearch listreplace listExplanation
How are you?HowWhereH->H, o->o, w->w, others substituted with last element.
How are you?How1234567H->H, o->o, w->w, others substituted with last element (7).
With the delete flag set, if a character is to be replaced and there is no replacement character, it will be deleted.
searched stringsearch listreplace listExplanation
How are you?How12(delete off) H->1, o->2, w->2, list too short, reuse last item
How are you?How12(delete on) H->1, o->2, w is deleted