什么是tr命令?tr,translate的简写,translate的翻译:
[tr?ns?leit]
vi. 翻译, 能被译出
vt. 翻译, 解释, 转化, 转变为, 调动
在这里用到的意思是转化,转变,转换,在linux下输入tr --help查看一下提示:
amosli@amosli-pc:~$ tr --help
Usage: tr [OPTION]... SE××× [SET2]
Translate, squeeze, and/or delete characters from standard input,
writing to standard output.
-c, -C, --complement use the complement of SE×××
-d, --deletedelete characters in SE×××, do not translate
-s, --squeeze-repeats replace each input sequence of a repeated character
that is listed in SE××× with a single occurrence
of that character
-t, --truncate-set1first truncate SE××× to length of SET2
--helpdisplay this help and exit
--version output version information and exit
SETs are specified as strings of characters. Most represent themselves.
Interpreted sequences are:
\NNNcharacter with octal value NNN (1 to 3 octal digits)
\backslash
\aaudible BEL
\bbackspace
\fform feed
\nnew line
\rreturn
\thorizontal tab
\vvertical tab
CHAR1-CHAR2all characters from CHAR1 to CHAR2 in ascending order
[CHAR]in SET2, copies of CHAR until length of SE×××
[CHARREPEAT] REPEAT copies of CHAR, REPEAT octal if starting with 0
[:alnum:]all letters and digits
[:alpha:]all letters
[:blank:]all horizontal whitespace
[:cntrl:]all control characters
[:digit:]all digits
[:graph:]all printable characters, not including space
[:lower:]all lower case letters
replace unsafe characters with their escape sequences. unsafe characters are those characters that may be altered during transport across the internet, and include the (<, >, ", #, {, }, |, \, ^, ~, [, ], and ') characters. this flag applies to all urls, including opaque urls.。