News for hackers. Stuff that matters.
Re:No engineer has ever sued because of constructive post-in... by hvidgaard on Friday February 07, 2020 @01:30AM (#22263714)
If someone actually told me they'd use 'cat error.log | grep 'ERROR:' | wc -l' to find an error count, they'd have to be gigantic drama queens or asshole for me to not hire them for a position, I'd even look for a different one if it's not quite the right fit for the one they're interviewing for. That is textbook example efficiency.
Re:No engineer has ever sued because of constructive post-in... by swish_bob on Friday February 07, 2020 @05:04AM (#22264587)
Dunno, watching people cat something then pipe it to grep drives me up the wall. I'll let piping grep to wc -l instead of just using -c pass this time though.
Re:No engineer has ever sued because of constructive post-in... by ash on Friday February 07, 2020 @10:13AM (#22266688)
I prefer cat-then-pipe while using shell interactively. It's easier to add things to the middle of the pipeline. You simply move the cursor the pipe character, and type another command.

Original:

  cat error.log | grep 'ERROR:' | wc -l
After change:

  cat error.log | grep -v 'SENSITIVE' | grep 'ERROR:' | wc -l
But with cat-less version, you have to think and sometimes even move things around.

Original:

  grep error.log 'ERROR:' | wc -l
After change:

  grep -v 'SENSITIVE' error.log | grep 'ERROR:' | wc -l
Moreover, some commands behave differently in cat-less mode. For example, gzip:

  gzip file.js | wc -c # oops, we've just removed file.js
  cat file.js | gzip | wc -c # shows compressed size