Data Science Certification Course (AI/ML + DL + Big Data + Python) by E&ICT, IIT Roorkee for $179 | Expires inEnroll Now
If we want to send the output of one program to another, we can use pipe. A pipe is denoted by "|".
"echo" command prints on the standard output whatever argument is passed to it.
"wc" command prints the number of characters, words and lines out of whatever you type on standard input. Start "wc" command, type some text and press Ctrl+d to end the input:
wc hi how are you [CTRL + d]
2 4 15
Now, if we want to count number of words, characters in the output of any program, we can pipe the output in the following way:
echo "Hello, World" | wc
You can also save the results using redirection, in the following way:
echo "Hello, World" | wc > wc_results
Please execute above command to succeed the assessment.
Taking you to the next exercise in seconds...