![这个命令有什么作用?](https://linux22.com/image/100181/%E8%BF%99%E4%B8%AA%E5%91%BD%E4%BB%A4%E6%9C%89%E4%BB%80%E4%B9%88%E4%BD%9C%E7%94%A8%EF%BC%9F.png)
cat telephone.txt | cat | cat | sed -e "s/t/T/" | tee cible | wc -l
答案1
当你有这样的命令时,尝试每个部分看看它的作用。
例如,运行其中的每一个来查看它们的作用:
cat telephone.txt
cat telephone.txt | cat
cat telephone.txt | cat | cat
cat telephone.txt | cat | cat | sed -e "s/t/T/"
cat telephone.txt | cat | cat | sed -e "s/t/T/" | tee cible
cat telephone.txt | cat | cat | sed -e "s/t/T/" | tee cible | wc -l
一旦你这样做了,你就会看到:
cat telephone.txt <-- reads file
cat <-- reads stdin and prints to stdout (from comments)
cat <-- reads stdin and prints to stdout (from comments)
sed -e "s/t/T/" <-- replaces the first lower case t on each line with an upper case T
tee cible <-- reads stdin and prints to stdout and also writes it to a file called "cible"
wc -l <-- counts the lines of stdout from above