7.6.5 字符转换与连接命令: tr, join, paste
1.tr - translate or delete characters
[dmtsai@study ~]$ tr [-ds] SET1 ...
[root@localhost tmp]# cat tr.file
[root@localhost tmp]# cat tr.file |tr "o" "O"
[root@localhost tmp]# cat tr.file |tr "[a-z]" "[A-Z]"
[root@localhost tmp]# cat tr.file |tr [0-9] [a-j]
google bba fbea #数字0-9用字码a-j替换
[root@localhost tmp]# cat tr.file |tr -d " "
[root@localhost tmp]# cat tr.file |tr -s [a-zA-Z0-9]
[root@localhost tmp]# cat tr.file |tr -s "\n"
[root@localhost tmp]# cat tr.file |tr " " ":"
google:110:5140 #用:做分隔符,而不再用空格
本章同步视频:https://edu.51cto.com/sd/e4874