@DaveK said:
@tster said:
No it isn't. You really think it's easier to type "cat |" than absolutely nothing at all?Who gives a fuck seriously? It's easier to type "cat |" than some of the alternatives that to cat that I've seen.
Yes, it can be. Sometimes you know which file you want to search before you decide on the pattern, and it's easier to type "cat filename | grep" while you think of the appropriate pattern and then add it on at the end. Typing "grep filename" and then navigating back to the gap between "grep" and "filename" to fill in the pattern doesn't flow as well and takes more keystrokes.
Using the "cat filename | grep pattern" is also great for re-using command lines. Sometimes you start out just looking at a file (say, "cat filename"). If you then decide to filter for a pattern, it can be easier to just up-arrow and tack on "| grep pattern" than to start from scratch by re-typing "grep pattern filename". Likewise, having the pattern at the end in the "cat filename | grep pattern" form makes it easier to re-run the command with a different pattern: just up-arrow and edit the command, which will be immediately to the left of the cursor. In the "grep pattern file" form, you have to first navigate the cursor to the pattern.