NoneTr is a *nix utility for character-level alterations to a stream. tr/// is a Perl operator named after this utility. For the tag used to build HTML tables, please use [html-table]. Use this tag only if your question relates to programming using tr. Questions relating to using or troubleshooting tr command-line options itself are off-topic.

tr (for "translate") is a standard utility in Unix, GNU/Linux, and other systems. It reads from standard input and writes to standard output, making specified character-level alterations.

One alteration it can make is to substitute individual characters, or groups of characters, with specified replacements; for example, tr a-z A-Z "translates" every occurrence of a lowercase ASCII letter to its uppercase counterpart.

Another alteration is to remove characters; for example, tr -d % "deletes" every instance of a percent sign, while tr -s % "squeezes" sequences of repeated percent signs (so that %% or %%% or %%%% or whatnot will become simply %). tr can also complement characters; for example, tr -cd '[:alnum:]' removes all non-alphanumeric characters.

tr/// is a Perl operator named for this utility. (It can also be written y///, after the same operator in sed.) It substitutes individual characters; for example, tr/a-z/A-Z/ translates every occurrence of a lowercase ASCII letter to its uppercase counterpart.

Links