Linux Command String Conversion -- tr
 
Name: tr
 
Location:/usr/bin/tr
 
Permission: All Users
 
Purpose: it can be used to delete text in a piece of information or replace text information.
 
Usage: tr [OPTION]... SET1 [SET2]
 
Option:
 
-D: Delete the SET1 string in the information.
 
-S replaces the repeated string
 
Example 1:
 
If tr does not have any Parameter options, it is replaced by default, which is consistent with the result of the-s parameter option.
 
 
$ last| tr  "[a-z]" "[A-Z]"|sed -n '1,5p'CWJY1202 PTS/0        :0               SAT JAN 10 22:14   STILL LOGGED IN   REBOOT   SYSTEM BOOT  3.2.0-24-GENERIC SAT JAN 10 21:45 - 23:48  (02:03)    CWJY1202 PTS/0        :0.0             SAT JAN 10 19:24 - DOWN   (00:00)    REBOOT   SYSTEM BOOT  3.2.0-24-GENERIC SAT JAN 10 14:17 - 19:24  (05:07)    REBOOT   SYSTEM BOOT  3.2.0-24-GENERIC FRI JAN  9 20:50 - 22:50  (01:59) 
 
$ last| tr -s  "[a-z]" "[A-Z]"|sed -n '1,5p'CWJY1202 PTS/0        :0               SAT JAN 10 22:14   STIL LOGED IN   REBOT   SYSTEM BOT  3.2.0-24-GENERIC SAT JAN 10 21:45 - 23:51  (02:05)    CWJY1202 PTS/0        :0.0             SAT JAN 10 19:24 - DOWN   (00:00)    REBOT   SYSTEM BOT  3.2.0-24-GENERIC SAT JAN 10 14:17 - 19:24  (05:07)    REBOT   SYSTEM BOT  3.2.0-24-GENERIC FRI JAN  9 20:50 - 22:50  (01:59)
 
 
Note: SET1 and SET2 must be enclosed by quotation marks, either single or double quotation marks.
 
Example 2:Tr command to delete the number in the output of file a (this is not to modify file) 
 
$ cat apa:11:asa:32:capp:5:bstort:1:dpear:4:aahello:3:f$ cat a| tr -d "[0-9]"pa::asa::capp::bstort::dpear::aahello::f
 
 
Note: The tr-d "[0-9]" file Syntax is incorrect. Files cannot be connected. You can use pipeline commands to receive data streams. 
 
 
To be continued ......