Compare the following commands:
cat f.txt | grep "someText"
grep "someText" f.txt
They both seem to work. But the documentation for cat says cat outputs the contents of the file rather than the file name and grep command takes file name but not file contents (correct me if I am wrong), then why does the first command work since it is feeding grep with the file contents rather than the file name.
Another question: they both work but why would one use the first line instead of the second, the first one is just redundant?