tee 管道
[[email protected] ~]# ip addr |grep ‘inet ‘ |tee ip.txt |awk -F"/" ‘{print $1}‘ |awk ‘{print $2}‘
127.0.0.1
128.172.16.60.1
[email protected] ~]# cat ip.txt
inet 127.0.0.1/8 scope host lo
net 172.16.60.1/24 brd 172.16.60.255 scope global eth0
[[email protected] ~]# ip addr |grep ‘inet ‘ |tee -a ip.txt |awk -F"/" ‘{print $1}‘ |awk ‘{print $2}‘ -a是追加的意思
127.0.0.1
172.16.60.1
[[email protected] ~]# date >date.txt
[[email protected] ~]# date |tee date.txt
[email protected] ~]# top -d 1 -b -n 1 > top.txt
[[email protected] ~]# top -d 1 -b -n 1 |tee top.txt