[转载] shell大小写字母转换
shell大小写字母转换
2008-05-0710:25
#!/bin/sh
#----------------------------------------------------------
#[:upper:][A-Z]
#[:lower:][a-z]
#[:digit:][0-9]
#[:alnum:][0-9a-zA-Z]
#[:space:]空格或tab键
#[:alpha:][a-zA-Z]
#----------------------------------------------------------
#tr
forfin*
do
mv$f`echo$f|tr"[:upper:]""[:lower:]"`
done
#awk
#把当前目录下的所有小写文件名都改为大写文件名。
ls|awk'{printf("mv%s%s\n",$0,toupper($0))|"sh"}'
#把当前目录下的所有大写文件名都改为小写文件名。
ls|awk'{printf("mv%s%s\n",$0,tolower($0))|"sh"}'
#sed
catfile|sed'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
相关推荐
tianhuak 2020-11-24
huha 2020-10-16
lianshaohua 2020-09-23
laisean 2020-11-11
zhangjie 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
以梦为马不负韶华 2020-10-20
CARBON 2020-10-20
彼岸随笔 2020-10-20
lianshaohua 2020-10-20
yutou0 2020-10-17
JohnYork 2020-10-16
xiaonamylove 2020-10-16
Julyth 2020-10-16
applecarelte 2020-10-16
ourtimes 2020-10-16