This is a magical command.
TR's whole spell is translate, that is, translation. The interesting thing is that we can make rules for translation. Use the following:
TR [option] set1 [Set2]
TR accepts input from the standard input and prints the result to standard output. The most basic function of TR is to replace the Set1 character set in order and substitute the character set in Set2. The following is a look at the parameters of tr.
-D Deletes the character of the Set1 specified later.
-C takes set of complement.
-S replaces the Set1 specified by a character that corresponds to a set2.
TR supports some sets of similar regular expressions. Rote memorization must not be remembered, so you can refer to the man manual.
In all of these specific collections above, only [: Upper:] and [: Lower:] can be substituted as many-to-many, the term is called the conversion character, because the characters of these two sets are ordered sequentially. The other characters can only be used for many-to-one substitution.
There is a question, if set1 word than characters in Set2 character, then will Set2 inside the last character to correspond to all the extra characters.
If the character of the Set2 is than characters to Set1, discard more than the characters in the Set2.
See how the actual application works.
The contents of Test.txt are as follows:
This is the introduction of the TR command, so-called practice makes perfect. This is especially true for learning shell commands, and it's easy to remember more times.
5 TR of the shell command