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.

This site uses Akismet to reduce spam. Learn how your comment data is processed.