1、举例如下,复制bash_profile 文件,命名为bash_profile.1,命令如下:[lele@Oracle ~]$ cp .bash_profile bash_profile.1
2、使用cat查看bash_profile.1,这里看到文件中有大写字符,如下:[lele@Oracle ~]$ cat bash_profile.1# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATH
3、使用tr命令,将上面bash_profile.1文件中的所有大写字符转换成小写字符,这里需要输入水瑞侮瑜bas茑霁酌绡h_profile.1文档,使用输入重定向符号< 命令如下:[lele@Oracle ~]$ tr 'A-Z' 'a-z' <bash_profile.1# .bash_profile# get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# user specific environment and startup programspath=$path:$home/binexport path[lele@Oracle ~]$
4、这里说明一下[lele@Oracle ~]$ tr 'A-Z' 'a-z' <bash_profile.1这里的tr 'A-Z' 'a-z' 就是说要把输入文档bash_profile.1文件中的所有大写字母A-Z全部转换成小写字符a-z,这里的小于符号<就是输入重定向符号,文件bash_profile.1就是需要输入的文件可以看到最后的文件中,都是小写字母了
5、tr命令,请参考我的百度经验 tr命令说明
6、如果以上经验帮到您,麻烦在左下角给点个赞,谢谢!
7、下面是man tr的所有文档###########SETs are specified as strings of characters. Most represent them- selves. Interpreted sequences are: \NNN character with octal value NNN (1 to 3 octal digits) \\ backslash \a audible BEL \b backspace \f form feed \n new line \r return \t horizontal tab \v vertical tab CHAR1-CHAR2 all characters from CHAR1 to CHAR2 in ascending order [CHAR*] in SET2, copies of CHAR until length of SET1 [CHAR*REPEAT] 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 [:print:] all printable characters, including space [:punct:] all punctuation characters [:space:] all horizontal or vertical whitespace [:upper:] all upper case letters [:xdigit:] all hexadecimal digits [=CHAR=] all characters which are equivalent to CHAR###########