linux中将所有的小写字符串全部转换为大写
001、tr
[root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试文本 aa BB cc dd ee FF jj kk ll mm NN RR [root@PC1 test]# cat a.txt | tr 'a-z' 'A-Z' ## 将所有的小写字符全部转换为大写字符 AA BB CC DD EE FF JJ KK LL MM NN RR

。
02、awk
[root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt aa BB cc dd ee FF jj kk ll mm NN RR [root@PC1 test]# cat a.txt | awk '{print toupper($0)}' AA BB CC DD EE FF JJ KK LL MM NN RR

.
03、sed
[root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt aa BB cc dd ee FF jj kk ll mm NN RR [root@PC1 test]# cat a.txt | sed 's/.*/\U&/' AA BB CC DD EE FF JJ KK LL MM NN RR

04、echo
[root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt aa BB cc dd ee FF jj kk ll mm NN RR [root@PC1 test]# cat a.txt | while read i; do echo ${i^^}; done AA BB CC DD EE FF JJ KK LL MM NN RR

。

浙公网安备 33010602011771号