1. 7

  2. 2

    I didn’t go through all of the examples, but complaining about:

     cat file1 file2 file3 | wc -w

    being useless and offering this:

     awk '{w = w + NF} END { print w }' file1 file2 file3

    as a better alternative is just silly. If I’m typing on the command line, I’m going to type the shortest amount of characters or I’m going to type it as I think it out in my head. People probably do the first version often because just previously they did cat file1 file file3 and now think, “ok, how many words is that” and so they just hit up and tack on | wc -w. In the time it took you to think of, type out, test, and probably tweak that awk statement, I’ve already typed out wc -w file[123], looked at the last line, moved on, and am now laughing at you while you read the awk manpage because someone told you “cat is useless!”

    1. 1

      Or as a zsh user, wc -w <file?

      (There are a few other non-optimal versions in the talk as well.)