What wc Means by Lines:

Every Unix/Linux user (and maybe Windows users too) is familiar with the wc command that counts characters, words, and lines. It an easy way to see how large a text file is and is often useful in scripts when you want to capture how many words or lines a file contains. I've been using it for decades and never thought too much about it.

Now Stefan tweets something about wc that I didn't know:

I immediately checked this on my Mac, which uses the BSD version of wc, and got the same result. As Stefan says, it's easy to get an off by one error. If you're using wc for anything other than casual information-a script, say-you should take this quirk in wc's behavior into account.

(Via Irreal)

Good safety tip. I think I learned about this already through experience but nice to have a reminder.



My original entry is here: What wc Means by Lines. It posted Sun, 24 Feb 2019 09:51:08 +0000.

Filed under: tech,