# Hmm, is wc supposed to behave that way?



## fonz (Feb 24, 2009)

When wc() is instructed to report a line count, it gives one line less than I expect when the last line doesn't end with a newline. Judging from the source, it seems to me like wc() simply counts newlines, which would explain why a last line not ending in a newline won't get the line counter incremented.

Is this a bug or is wc() supposed to behave like this?

Alphons


----------



## crsd (Feb 24, 2009)

_-l
    Write to the standard output the number of <newline> characters in each input file._

http://www.opengroup.org/onlinepubs/9699919799/utilities/wc.html


----------



## fonz (Feb 24, 2009)

All I needed to know, thanks!


----------

