这个命令有什么作用?

这个命令有什么作用?
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

相关内容