Name: TR
Location:/usr/bin/tr
Permissions: All Users
Function: can be used to delete text in a piece of information, or to replace the text information
Usage: TR [OPTION] ... SET1 [SET2]
Options:
-D Delete the SET1 string in the message
-S replaces duplicate strings
Example 1:
TR is replaced by default when there are no parameter options, 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 22:14 still logged in REBOOT SYSTEM BOOT 3.2.0-24-generic Sat Jan 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 14:17-19:24 (05:07) REBOOT SYSTEM BOOT 3.2.0-24-generic FRI JAN 9 20:50-22:50
$ last| Tr-s "[A-Z]" "[A-z]" |sed-n ' 1,5p ' CWJY1202 pts/0 : 0 SAT JAN 22:14 STIL loged in rebot SYSTEM BOT 3.2.0-24-generic Sat Jan 21:45-23:51 (02:05) CWJY1202 pts/0 : 0.0 Sat Jan 19:24-DOWN
(00:00) rebot SYSTEM BOT 3.2.0-24-generic SAT JAN 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 are quoted, and both single and double quotation marks can be
Example 2:The TR command deletes the number in the A file output (this is not a modified file a)
$ cat apa:11:asa:32:capp:5:bstort:1:dpear:4:aahello:3:f$ Cat a| Tr-d "[0-9]" Pa::asa::capp::bstort::d pear::aahello::f
Note: tr-d "[0-9]" file syntax is incorrect and cannot be used to receive data streams through pipeline commands, etc.
Cond......
string conversion of Linux commands--tr