tr DEMO

测试数据:

[weblogic@etp-mall-dev7][/tmp]$ cat msn.txt 
aaa bbb
bbb ccc
ccc ddd
bbb eee
aaa ccc
bbb sss

转换大小写:

eg.1:
[xiluhua@vm-xiluhua][~]$ cat msn.txt | tr a-z A-Z
eg.2:
AAA BBB BBB CCC CCC DDD BBB EEE AAA CCC BBB SSS

用tr命令转换一个文件的内容,并将转换的结果输出到另一个文件

eg.1:
[xiluhua@vm-xiluhua][~]$ cat msn.txt | tr [:lower:] [:upper:] > msn.bk
eg.2:
[xiluhua@vm-xiluhua][~]$ tr [:lower:] [:upper:] < msn.txt > msn3.bk

[xiluhua@vm-xiluhua][~]$ cat msn3.bk 
AAA BBB
BBB CCC
CCC DDD
BBB EEE
AAA CCC
BBB SSS

 

posted @ 2016-07-15 17:36  xiluhua  阅读(167)  评论(0编辑  收藏  举报