#!/bin/sh #———————————————————- # [:upper:] [ A – Z ] # [:lower:] [ a – z ] # [:digit:] [ 0 – 9 ] # [:alnum:] [ 0 – 9 a – z A-Z] # [:space:] 空格或t a b键 # [:alpha:] [ a – z A – Z ] #———————————————————- #sed cat file | sed -i y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ #tr for f in * 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”} # ${string/substring/replacement} 使用$replacement,来代替第一个匹配的$substring ${string//substring/replacement} 使用$replacement,代替所有匹配的$substring