15

Does anyone else use:

cat /path/to/file | grep "blah"

Rather than:

grep "blah" /path/to/file

...when grepping? Or is it just me? Mainly asking because in my half asleep state I just wrote `tail -f | grep "blah"` by mistake and wondered why it was taking way to long to read the file...

Comments
  • 2
    Interesting, happens to me by accident. Just the reality, that most of the time, you have to pipe the input to grep, conditions me to automatically write such commands.
  • 3
    Yepp, I also do the pipey thing more ofthen than I should. :)
  • 1
    I do `ag "something"` =P
  • 2
    I always pipe because I can never remember the argument order
  • 1
    ddnt kno the second was an option
  • 0
    I'm currently in the process of learning shell properly again, and this is something I'm trying to avoid.
  • 0
    @M3m35terJ05h to my knowledge, most programs can take the positional arguments as either the first or the last argument, so that shouldn't be an issue.
  • 0
    it's a common mistake
  • 4
    I do it too because I don't have the foresight to realize what I want until I've already typed it. I think 'oh I'll just cat real quick' and then, several minutes later when I've finished typing the command, I think 'oh that file is way too big, I should grep' and here we are.
  • 0
    @chabad360 ok well that just upsets me
Add Comment