命令tee
命令语法
teee(选项)(参数)命令描述
tee命令有两层含义,一是重定向,二是打印输出到屏幕上。命令选项
-a:向文件中重定向时使用追加模式(相当于>>);
-i:忽略中断(interrupt)信号。命令示例
[root@localhost ~]# cat student
1 sasd
2 dfds
3 sa
2 sa
[root@localhost ~]# cat a.txt
1 sasd
2 dfds
2 sa
3 sa
[root@localhost ~]# > a.txt //表示清空内容的意思
[root@localhost ~]# cat student |tee a.txt //注意:这里的tee表示重定向,使用tee的时候需要用|
1 sasd
2 dfds
3 sa
2 sa
[root@localhost ~]# cat a.txt
1 sasd
2 dfds
3 sa
2 sa
[root@localhost ~]# cat student |tee -a a.txt //tee -a 表示追加
1 sasd
2 dfds
3 sa
2 sa
[root@localhost ~]# cat a.txt
1 sasd
2 dfds
3 sa
2 sa
1 sasd
2 dfds
3 sa
2 sa
命令tr
命令语法
tr(选项)(参数)命令描述
用于替换命令示例
[root@localhost ~]# echo 'student' |tr '[sd]' '[SD]'
StuDent
[root@localhost ~]# echo 'student' |tr 's' 'S'
Student
[root@localhost ~]# echo 'student' |tr '[a-z]' '[A-Z]'
STUDENT
[root@localhost ~]# echo 'student' |tr '[a-z]' '1'
1111111