一、使用 tr 命令
|
1 2 3 4 |
> echo True | tr '[A-Z]' '[a-z]' # 转小写 true > echo True | tr '[a-z]' '[A-Z]' # 转大写 TRUE |
二、使用 typeset
|
1 2 3 4 |
> typeset -u xxx; xxx=True; echo $xxx # 转大写 TRUE > typeset -l xxx; xxx=True; echo $xxx # 转小写 true |
三、使用 sed 命令
|
1 2 3 4 |
> echo True | sed 's/[a-z]/\u&/g' - # 转小写 TRUE > echo True | sed 's/[A-Z]/\l&/g' - # 转大写 true |
![[leetcode-shell]192-统计词频](https://www.dyxmq.cn/wp-content/themes/begin/prune.php?src=https://www.dyxmq.cn/wp-content/uploads/2020/02/b3b4a-image6c552cb516ad2b7c.png&w=280&h=210&a=&zc=1)
![[leetcode-shell]195-第十行](https://www.dyxmq.cn/wp-content/static/thumbnail/PIC_20140218_145658_510.jpg)


1F
3 使用 sed 命令 大小写注释反了