When learning about the wc command, it was shown to us as
$ cat filename.txt | wc
but in the Ecosystem project it asks us to redirect a file as the standard input to the wc command. So we wrote
$ wc -l < filename.txt
Without the -l option, it seems that both the pipe and the standard input redirect do the same exact thing. Is there a reason for doing one instead of another?
I know that I can use the code
$ cat filename.txt | wc | cat > filename2.txt
to copy the word count to filename2. Would the following code do the same thing?
$ wc < filename.txt | cat > filename2.txt