linux 大小写转化
程序员文章站
2022-04-09 17:41:22
(1)sed: cat file | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' (2)tr: cat file | tr a-z A-Z cat file | tr "[:lower:]" "[:upper:]" ( ......
(1)sed:
cat file | sed 'y/abcdefghijklmnopqrstuvwxyz/abcdefghijklmnopqrstuvwxyz/'
(2)tr:
cat file | tr a-z a-z
cat file | tr "[:lower:]" "[:upper:]"
(3)perl:
$string="abcdef";
$string =~ tr/[a-z]/[a-z]/;
or
$string=uc($string); #大小转小写用lc,具体参见perldoc -f lc与perdoc -f uc
上一篇: 记录日常Linux常用软件
下一篇: Redis之Redis安装