Why would we redirect standard input to the wordcount command?


#1

I’m having trouble grasping the concept of redirecting to commands, like the wordcount command.

In ‘Learn the Command Line’/Ecosystem project step 4 tells me to: " Redirect plants.txt as standard input to the wordcount command. Use the -l option on the wordcount command. "

I used help to see the command is ‘wc -l <plants.txt’ but my question is WHY?? What does this do?

https://www.codecademy.com/courses/learn-the-command-line/projects/ecosystem


#2

Please post a link to the exercise. Thanks.


#3

Whoops, sorry. Edited to add link.


#4

wc is a command, and I’m guessing the -l switch is for line count, not word count. Including blank lines, there are five in all.

Without the -l option, we get,

 5  77 503

which one may deduce to be line count, word count, character count, all combined.